Link to home
Start Free TrialLog in
Avatar of INAUSA
INAUSAFlag for United States of America

asked on

Is there a timeout for the CeRapiInit() function call in the CERAPI Library

I am maintining some old VB6 code, and came across a situation I would like to improve.  The current code asks a user if a handheld scanner (Symbol's 2800 Pocket PCs) in the cradle attched via a com port to the computer.  If the user says yes and there is no handheld scanner attached to the computer, then then following line will hang up on execution:

intRetVal = CeRapiInit()

No error message will be provided, and a .exe file can still be seen under the processes tab.  The hangup will continue until the process is deleted.

Is there a timeout for the CeRapiInit() function call in the CERAPI Library?  Or better, is there a better way to test if the handheld device is on the cradle so that I can make this test prior to the function call?

All help is appreciated.  Thank you.

intResponse = MsgBox("Is the scanner connected to the PC?", vbYesNo + vbApplicationModal + vbQuestion, "Confirm")
    If intResponse = vbNo Then End
    intRetVal = CeRapiInit()
    If intRetVal <> INIT_SUCCESS Then
        MsgBox "Failed to initialise RAPI with device with error " & _
    End If

Open in new window

Avatar of alexey_gusev
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of INAUSA


Thanks alexey_qusey, but unfortunately I do not have access to the link you provided due to "security".  I looked for a GetDeviceId() member under the CERAPI module, but I could not find anything.  Do you know if it should be included in this module?

Thanks again for any help.
that's the following method defined in ceutil.h in SDK and located in ceutil.dll:


DEVICEID __stdcall CeGetDeviceId( void );

Depending on what is your CERAPI module it can be mapped to anything :)
You may easily define a wrapper to it and call it when required
Avatar of INAUSA


Thanks again, alexey_qusev.  I am now having a problem trying to reference the CEUtil.dll file in my VB6 application.  When I try to reference the DLL, I get the following error message: "Can't add a reference to the specified file."  I, then, went to verify that it was registered so I used regsvr32 to register ceutil.dll, and I recieved the following error message: "CEUtil.dll was loaded, but the DLLRegisterServer entry point was not found.  The file cannot be registered."  I am new to working with DLL files in VB6, so any help would be great.  Thanks again!
here you may find some examples of how to declare Win32 API in VB6: