10. The Remote API (RAPI)

< BACK  NEXT >
[oR]

Chapter 10. The Remote API (RAPI)

The Remote API (RAPI) provides a set of functions for accessing Windows CE functionality from desktop applications. These functions are available when a Windows CE device is connected through ActiveSync. RAPI functions are available for the following:

  • Device system information, such as version, memory, and power status

  • File and directory management

  • Property database access

  • Registry manipulation

  • Shell and window management

Further, RAPI allows custom functions placed in DLLs on the device to be called from the desktop, and this provides complete flexibility in managing a Windows CE device from your desktop application. RAPI custom functions can be used to allow a desktop application to communicate with a Windows CE application through ActiveSync, something that is not possible using TCP/IP sockets (see Chapter 8).

Most RAPI functions have Windows CE counterparts, and the RAPI functions generally have the same parameters and behaviors. For example, RAPI has a function called CeGetVersionEx that provides the same functionality as GetVersionEx when called directly from a Windows CE application. However, there are a few things you need to do when calling RAPI functions:

  • Call CeRapiInit or CeRapiInitEx to initialize the connection to the Windows CE device.

  • Call CeGetLastError on failure to determine if a RAPI error occurred.

  • Call CeRapiUninit to close down the connection.

Remember, RAPI functions are called from Win32 applications running on Windows NT/98/2000. Most RAPI functions expect Unicode strings, so you will either have to compile your application for Unicode (by defining "_Unicode" in the compiler settings), or convert strings to Unicode if you are compiling for multi-byte character (ANSI) strings. Note that an application compiled for Unicode will probably not run on Windows 98, as this operating system does not provide complete Unicode support.

RAPI currently can only be used against a Windows CE device it cannot be used under emulation. Further, ActiveSync does not support more than one concurrently connected CE device, so RAPI function calls are always made against that connected device; you don't have to specify which type of device to direct the calls to.


< BACK  NEXT >


Windows CE 3. 0 Application Programming
Windows CE 3.0: Application Programming (Prentice Hall Series on Microsoft Technologies)
ISBN: 0130255920
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net