CeRapiInitEx

The CeRapiInitEx function attempts to initialize the Windows CE Remote API and initially returns an event handle.

Syntax

HRESULT CeRapiInitEx(RAPIINIT* pRapiInit);

At a Glance

Header file: Rapi.h
Platforms: H/PC
Windows CE versions: 2.0 and later

Parameters

pRapiInit
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 E_SUCCESS if the connection is successful or E_FAIL if an error occurred.

Return Values

If this function initially succeeds, it returns E_SUCCESS. If this function is called when RAPI is already initialized, it returns E_FAIL.

Remarks

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.

See Also

CeRapiInit, RAPIINIT