Copy Files From your PC to PocketPC | CodeGuru

Copy Files From your PC to PocketPC

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. […]

Written By
CodeGuru Staff
CodeGuru Staff
Jul 11, 2002
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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.

Downloads

Download demo project – 13 Kb

Download source – 2 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.