CeRapiInitEx (Windows CE 5.0)

Send Feedback

This function attempts to initialize the Windows CE remote application programming interface (RAPI) and initially returns an event handle.

HRESULTCeRapiInitEx(RAPIINIT* pRapiInit);

Parameters

  • pRapiInit
    [in] Pointer to a RAPIINIT structure. The cbSize member of this structure contains the size of the structure being passed in. Initially, a handle to an event is passed back in the heRapiInit member of this structure. When the connection is made or an error occurs, the event is set. The hrRapiInit member of this structure contains the value S_OK if the connection is successful, or E_FAIL if an error occurred.

Return Values

S_OK indicates success. E_FAIL indicates failure. E_INVALIDARG indicates that an invalid value was encountered.

Remarks

This function is a part of the remote application programming interface (RAPI), which invokes function calls on a Windows CE–based device. RAPI functions are supported only for applications that run on desktop platforms.

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 computer and the target 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. If the CeRapiInitEx function is used to initialize RAPI, all other RAPI calls should be made on a different thread than the thread that calls CeRapiInitEx. If a RAPI call is made in this same thread and the device disconnects in the middle of the RAPI call, the application may have some threads block.

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 1.0 and 1.01, use the PegRapiInitEx function.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Rapi.h.
Link Library: Rapi.lib.

See Also

RAPI Functions | CeRapiInit | CeRapiUninit | MsgWaitForMultipleObjects | RAPIINIT

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.