Virtual Developer Workshop: Containerized Development with Docker

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
CreateFile() CeCreateFile()
WriteFile() CeWriteFile()
ReadFile() CeReadFile()
etc... etc...

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.


Download demo project - 13 Kb
Download source - 2 Kb


  • Link don`t work)

    Posted by ALEKSANDR on 02/17/2017 04:14am

    Link http://www.codeguru.com/cpp/w-p/ce/article.php/c3521/Rapi_src.zip don`t work please update link Phanks

  • getting SD card directory

    Posted by ugroczkycs on 11/14/2006 05:10pm

    i'd like to copy files to the SD card. How can i find SD card directory name? thanks

  • Writing actual size

    Posted by llcoolplay on 11/09/2004 01:19am

    Thank you for the source code. I've just made som minor changes. Etc. I added the iBytesRead instead of always writing with BUFFER_SIZE. Also I added the call to CeSetEndOfFile, in case of re-writing a smaller file to the Pocket PC. int iBytesRead = 0; while((iBytesRead = oldFile.Read(&cTemp, BUFFER_SIZE)) > 0){ CeWriteFile(h, &cTemp, (DWORD)iBytesRed, &nbytes, NULL); } CeSetEndOfFile(h);

  • question plz:

    Posted by syri on 03/05/2004 01:39am

    hi i want to thank you for the information i got. and i have request plz: i want to learn about programing pocket pc by C# but at begining i want to understand what is pocket pc? i want to design program on pocket pc sends and reseives data from Desktop database server through wireless connection. it is important to know how to exchange these data between the two devices (pocket pc & desktop pc). so i hope & wish that you help me and give me your advice, and if i can obtain anything help me like websites adresses,or forums or tutorials or ebooks or articles...etc. thank you very much & i hope i don't waste your time.

  • Thank you...

    Posted by Legacy on 01/21/2004 08:00am

    Originally posted by: Baazunga

    After using the standard scriptlike programs out on the market for free i.e EzSetup etc and quickly realizing its limits I was looking for something like this. I found it, made som minor modifications and now have a really good installationprogram. Thanks... keep up the good work. Great comments also, helped me tons!

  • wireless communication between pocket pc and server

    Posted by Legacy on 01/17/2004 08:00am

    Originally posted by: aryan

    we develop project on this application
    so, u have any information about it, then send me..

  • To Storage card

    Posted by Legacy on 10/29/2003 08:00am

    Originally posted by: Zubair

    Nice sample code. I need to copy file to storage card. Is there any good way to find storage card folder name. They seem to be different on devices, like "Storage Card", "Storage Card2", "SD Card", etc.


    Zubair 10/29/03

  • Modifying Sample Code

    Posted by Legacy on 10/07/2003 07:00am

    Originally posted by: Ernie D.

    I've taken your great sample code and I'm trying to modify it so that it creates a database in the object store instead of creating a file. But I'm having all sorts of troubles with headers. I'm sort of a newbie at this, as I'm sure you'll be able to tell :-) I created a new .cpp file, and this line of code:

    CEOID oid;

    produces an error that CEOID is an undeclared identifier. What header file do I need to add so that this will work? I tried adding this path:

    C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Include\Emulator

    under "Project Settings/C++/Preprocessor/Additional include directories"

    When I do that, the error about CEOID (and a lot of others) goes away, but now I get several errors including:

    stdlib.h: '_JBLEN' : undeclared identifier
    winnt.h: 'PCONTEXT' : missing storage-class or type specifiers
    winnt.h: 'ContextRecord' : missing storage-class or type specifiers

    I know this is just a matter of knowing what headers are needed. What .h files do I need to include at the top of my new .cpp file? Thanks a lot!


  • CeSHCreateshortcut - shortcut path and spaces?

    Posted by Legacy on 09/19/2003 07:00am

    Originally posted by: Norm

    I've tried using CeSHCreateshortcut(LPWSTR, LPWSTR. It seems to work for the most part, but empty spaces don't seem to work. For example, "\\My Documents\\..." I get cannont find 'My'... If I get rid of the space, there's no error, but the path is wrong.

    Any help, thanks,


  • What abt Pocket PC to Desktop via Wireless

    Posted by Legacy on 09/06/2003 07:00am

    Originally posted by: Guruprasad

    Hi all,
    I am using a 802.11b wireless LAN to connect to PC. Doing this establishes a LAN IP for the handheld. I need to copy some files to the PC and then from the PC to the handheld device. From desktop to PC is no problem I can use the CopyFile() API and give the path as "\\Machine Name\Folder\DestFileName" - it works - without ActiveSync!
    But from the PC to the handheld, I have problem as I don't have a machine name for the handheld. So I have depend on CeWriteFile RAPI file - for which I have to depend on the ActiveSync :-(
    I want to give up ActiveSync because if the Wireless LAN fails, the ActiveSync disconnects and doesn't connect automatically.
    So I was wondering if there is any way of either starting the ActiveSync from the Handheld device programmatically. Or otherwise if there is any way of copying the files from PC to the handheld which doesn't depend on ActiveSync.
    Thanks in advance and best regards,

  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date