Click here to Skip to main content
15,881,248 members
Articles / Mobile Apps

Command-line utility for PocketPC

Rate me:
Please Sign up or sign in to vote.
3.61/5 (18 votes)
26 Jan 2004CPOL1 min read 130.5K   507   48   22
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Moldova (Republic of) Moldova (Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralSystem information Pin
Melkske19753-Jun-10 21:11
Melkske19753-Jun-10 21:11 
GeneralThanks Pin
Alexander Gorshkov17-Jan-09 6:43
Alexander Gorshkov17-Jan-09 6:43 
GeneralBuffer overun Pin
Member 41451287-Mar-08 20:23
Member 41451287-Mar-08 20:23 
GeneralCopying Pin
fdgf16-Dec-07 11:20
fdgf16-Dec-07 11:20 
Generalwhy buffer size is 5006 Pin
AgunJ27-Aug-07 22:51
AgunJ27-Aug-07 22:51 
QuestionSD card directory Pin
ugroczkycs14-Nov-06 3:22
ugroczkycs14-Nov-06 3:22 
AnswerRe: SD card directory Pin
Alexander Silonosov15-Nov-06 2:57
Alexander Silonosov15-Nov-06 2:57 
Questionpossible to convert to vb .net Pin
athinarayanan2-Nov-06 3:26
athinarayanan2-Nov-06 3:26 
GeneralBug fix : memory leak [modified] Pin
Vince Ricci10-Jul-06 4:56
Vince Ricci10-Jul-06 4:56 
QuestionHow to add to "Send to" meu ?? Pin
julian_hung9-Jun-06 23:47
julian_hung9-Jun-06 23:47 
AnswerRe: How to add to "Send to" meu ?? Pin
Alexander Silonosov15-Nov-06 3:01
Alexander Silonosov15-Nov-06 3:01 
GeneralThank you! Pin
hepan19-Jan-06 21:11
hepan19-Jan-06 21:11 
QuestionHow to avoid memory read error exceptions? Pin
Carlos Eugênio X. Torres22-Jun-05 23:37
Carlos Eugênio X. Torres22-Jun-05 23:37 
AnswerRe: How to avoid memory read error exceptions? Pin
Alexander Silonosov23-Jun-05 1:32
Alexander Silonosov23-Jun-05 1:32 
GeneralRe: How to avoid memory read error exceptions? Pin
Carlos Eugênio X. Torres23-Jun-05 4:24
Carlos Eugênio X. Torres23-Jun-05 4:24 
GeneralRe: How to avoid memory read error exceptions? Pin
Alexander Silonosov23-Jun-05 5:06
Alexander Silonosov23-Jun-05 5:06 
Generalcreating directory Pin
hadaf917-Apr-05 23:42
hadaf917-Apr-05 23:42 
GeneralRe: creating directory Pin
Alexander Silonosov18-Apr-05 20:17
Alexander Silonosov18-Apr-05 20:17 
Hello,

Just now, I take a look at rcmd.exe sources and notice that new directory should be created when copy files to PocketPC->PC (and PC->PPC).

As I get from sources now , you cant copy to unexisting folder.
Instead you may copy from "c:\my data\" to PPC (try with slash or without) , in this case "my data" folder will be created at destination and all folder content will be copyed.

Another way is to add some code for creating folders to rcmd.exe sources and compile it and share it with codeproject Smile | :) .



--
Alexander Shilonosov

GeneralRe: creating directory Pin
quentinsiraut19-Apr-05 5:17
quentinsiraut19-Apr-05 5:17 
GeneralTelnet and RCMD Pin
quentinsiraut15-Apr-05 8:12
quentinsiraut15-Apr-05 8:12 
GeneralRe: Telnet and RCMD Pin
Alexander Silonosov15-Apr-05 20:33
Alexander Silonosov15-Apr-05 20:33 
GeneralRe: Telnet and RCMD Pin
quentinsiraut19-Apr-05 5:20
quentinsiraut19-Apr-05 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.