Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Command-line utility for PocketPC

0.00/5 (No votes)
26 Jan 2004 1  
RAPI based utility for copying files and folders PC->PocketPC (and vice versa). There is also - Dir, Del, Db commands.

Introduction

This utility (rcmd.exe) can copy files and folders (with subfolders) to PocketPC or from PocketPC to desktop PC. I integrated this tool into "Send To" menu. And now I am able to copy any file/folder to my device without opening ActiveSync's browser. This tool is also useful for some kind of automation.

This is a command-line Win32 application which uses RAPI to work with PocketPC. To run this utility, you should have ActiveSync installed in Desktop PC.

Windows CE Remote API

With RAPI, you can write data to or read data from a Windows CE-based device remotely with a desktop computer. This API support various functions:

  • System Information Functions

    about memory, power, desktop, stores, password.

  • Database Functions

    retrieving and storing data.

  • File and Directory Management Functions

    creating, deleting files/folders, changing attributes.

  • Registry Management Functions

    retrieving and storing data.

  • Shell Management Functions

    shortcuts, special folders.

  • Window Management Functions

    enumerating, getting properties of windows.

This API also allows to execute applications and call a function from a DLL inside PocketPC. I think it's a great API for automating PocketPC from Desktop.

Using the sources

To build the project, you need to setup eMbedded Visual Tools (or PocketPC SDK), and setup directories in Visual C++ 6.0. Add ActiveSync inc\ and lib\ folders. Use menu Tools -> Options -> directories tab. In my case, I added C:\Windows CE Tools\wce300\MS Pocket PC\support\ActiveSync\inc (and \lib) folders.

The sources consist of a CRapi class and main module. CRapi.cpp has some public methods:

//
// copy files (with subfolders, by mask) between Destop <-> PocketPC.
//
// parameters:
//  par1 - path to copy from 
//  par2 - path to copy to
//
//  The paths may be from Desktop or PockePC
// (but both can not be from one target)
int CRapi::copy(LPCTSTR par1, LPCTSTR par2, LPCTSTR par3, LPCTSTR par4)
...
...

//
// Delete files by mask
//
//
int CRapi::del(LPCTSTR par1, LPCTSTR par2, LPCTSTR par3, LPCTSTR par4)
...
...

//
// Show files and folders
//
// dir c:\*
// dir \temp\*
// dir "\my documents\*" 
//
int CRapi::dir(LPCTSTR par1, LPCTSTR par2, LPCTSTR par3, LPCTSTR par4)
...
...

//
// Rinning application in PPC 
//
int CRapi::run(LPCTSTR par1, LPCTSTR par2, LPCTSTR par3, LPCTSTR par4)
...
...

//
// enumerates DataBases in PPC
//
int CRapi::db(LPCTSTR par1, LPCTSTR par2, LPCTSTR par3, LPCTSTR par4)
...
...

History

  • Dec 2003: Fixed some bugs.
  • Aug 2002: First release.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here