Environment: [eg 98, Me, W2K, XP]
Have you ever wanted to copy a file from your Desktop Computer to your handheld Pocket PC?
This included any Windows CE version too?
Well if so, I will present an easy way to do it here: It’s called the Remote Application Programming Interface, or, RAPI
in this article. It is touched on in the MSDN but not really explained very well.
RAPI encapsulates the old file function functionality:
|Old C function||RAPI Function|
Ok, you get the idea…
So how do I call these RAPI functions?
There are two ways I know of. These functions are defined in the Microsoft include file: rapi.h. You simply include this in your project along with linking in rapi.lib and your business. However, since these two files are not very common and will crash a machine that doesn’t have the correct .dll’s. By the way, tehse are installed with ActiveSync. Since this is a bit frustrating, we can do it the hard way. We can manually load the exported functions from the .dll itself. This is done for you in the Initialization function of my Wrapper class.
How do I use this in my application?
1. Alright, download the source files: RencherRAPI.cpp and RencherRAPI.h
2. Include them in your project.
3. Include RencherRAPI.h in the .h file of where you would like to connect to the Pocket PC.
4. In the public section of the class declaration, create a member variable of type CRencherRAPI.
5. Someplace in your OnInitialUpdate() or InitDialog() functions or someplace else call the InitializeSettings() member variable
[by the way this can be seen in RencherRAPI.cpp].
6. If it succeeds, that means RAPI is alive and well and you have a Pocket PC or Windows CE device connected!
7. To transfer a file from the PC to the Pocket PC, call the CopyFiletoWinCE() function.
There is tons of other functionality in RAPI. This article is designed to show you how to call this interface, you can figure out how to utilize the other RAPI calls defined in the MSDN and elsewhere. Best of luck.