Remote Application Programming Interface (RAPI) Reference (Windows CE 5.0)

Send Feedback

This section discusses how to use remote application programming interface (RAPI), in the Microsoft Windows CE programming environment.

Once a connection is established between a Windows CE-based device and the desktop computer, RAPI gives an application running on a desktop computer the ability to invoke function calls on a Windows CE–based platform. The desktop computer is the RAPI client and the Windows CE–based platform is the RAPI server.

The function calls behave much like the equivalent Windows CE functions. For the most part, RAPI functions have the same syntax, parameters, and return values as the corresponding Windows CE versions. RAPI functions contain a Ce prefix to differentiate them from the Windows CE functions. Any other differences are noted in the reference documentation for the RAPI functions.

RAPI Initialization

Before you can invoke any RAPI function, you must initialize the underlying communications layer between the host computer and the mobile device, which must be connected to the host computer through a cable or a cradle. There are two versions of the RAPI initialization function you can use: CeRapiInit and CeRapiInitEx. CeRapiInit does not return until the connection is made, an error occurs, or another thread calls CeRapiUninit.

CeRapiInitEx works slightly differently. Instead of blocking the calling thread, it returns an event handle to indicate when initialization is complete. Use CeRapiInitEx to avoid blocking a thread inside 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 sets the event specified in the heRapiInit member of the RAPIINIT structure. After calling CeRapiInitEx, check the return value to determine whether an error occurred. If the call was initially successful, call the MsgWaitForMultipleObjects function to wait for the event handle passed back in the heRapiInit member of the RAPIINIT structure. When the event is set, check the hrRapiInit member of the RAPIINIT structure to determine whether the connection was successful. To shut down or to stop the connection process, call the CeRapiUnInit function.

Remarks

If you want your RAPI application to automatically execute when a mobile device connects to the desktop computer, do not put your application in StartUp or allow it to autorun. Instead, register it to be automatically run by ActiveSync upon device connection. For more information, see MSDN.

String and character parameters must be in Unicode format. Use the appropriate conversion routines, if necessary.

Note   Do not include rapi.dll with your application's desktop installation.

In This Section

This language reference section contains descriptions of RAPI programming elements.

See Also

ActiveSync | ActiveSync Application Development | ActiveSync Reference

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.