The CeRapiInitEx function attempts to initialize the Windows CE Remote API and initially returns an event handle.
HRESULT CeRapiInitEx(RAPIINIT* pRapiInit);
Header file: | Rapi.h |
Platforms: | H/PC |
Windows CE versions: | 2.0 and later |
If this function initially succeeds, it returns E_SUCCESS. If this function is called when RAPI is already initialized, it returns E_FAIL.
The CeRapiInitEx or CeRapiInit functions must be called before any remote API calls can be performed. They initialize the underlying communications layers between the desktop PC and the target platform device.
Call CeRapiInitEx to avoid blocking a thread inside of a call to CeRapiInit. CeRapiInitEx returns immediately and continues initialization until the connection is made, until an error occurs, or until there is a call to CeRapiUninit. When CeRapiInitEx is complete it then sets the event specified in the heRapiInit member of the RAPIINIT structure.
After calling CeRapiInitEx, check the return value to see if an error occurred. If the call was initially successful, call the MsgWaitForMultipleObjects function to wait on the event handle passed back in the heRapiInit member of the RAPIINIT structure. When the event is set, check the hrRapiInit member of the structure to determine if the connection was successful.
To shut down or to abort the connection process, call the CeRapiUnInit function.
When writing applications for Windows CE versions 1.0 and 1.01, use the PegRapiInitEx function.
For more information about using RAPI functions, see Invoking Functions from a Desktop Computer.