Click here to Skip to main content
Licence CPOL
First Posted 26 Jan 2004
Views 101,607
Downloads 145
Bookmarked 46 times

Command-line utility for PocketPC

By | 26 Jan 2004 | Article
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)

About the Author

Alexander Shilonosov

Web Developer

Moldova (Republic Of) Moldova (Republic Of)

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralSystem information PinmemberMelkske197521:11 3 Jun '10  
GeneralThanks PinmemberAlexander Gorshkov6:43 17 Jan '09  
GeneralBuffer overun PinmemberMember 414512820:23 7 Mar '08  
GeneralCopying Pinmemberfdgf11:20 16 Dec '07  
Generalwhy buffer size is 5006 PinmemberAgunJ22:51 27 Aug '07  
QuestionSD card directory Pinmemberugroczkycs3:22 14 Nov '06  
AnswerRe: SD card directory PinmemberAlexander Shilonosov2:57 15 Nov '06  
Questionpossible to convert to vb .net Pinmemberathinarayanan3:26 2 Nov '06  
GeneralBug fix : memory leak [modified] PinmemberVincent_RICHOMME4:56 10 Jul '06  
QuestionHow to add to "Send to" meu ?? Pinmemberjulian_hung23:47 9 Jun '06  
AnswerRe: How to add to "Send to" meu ?? PinmemberAlexander Shilonosov3:01 15 Nov '06  
GeneralThank you! Pinmemberhepan21:11 19 Jan '06  
QuestionHow to avoid memory read error exceptions? PinmemberCarlos Eugênio X. Torres23:37 22 Jun '05  
Hi, I'm using your code on desktop application in VC++ to copy files from PC->PPC and PPC->PC. But, in the middle of a copy process, if I take the windows ce device off from the cradle (disconnect it) the program fails in a windows memory read error and the program exits!! I tryied to use try-catch into my code, but it couldn't avoid that error. What solution do you advise?
Thanks!
 
Carlos Eugênio Torres
Software Analyst and Developer
Microsoft Certified Application Developer (MCAD.NET)
email: carloseugeniotorres@gmail.com
AnswerRe: How to avoid memory read error exceptions? PinmemberAlexander Shilonosov1:32 23 Jun '05  
GeneralRe: How to avoid memory read error exceptions? PinmemberCarlos Eugênio X. Torres4:24 23 Jun '05  
GeneralRe: How to avoid memory read error exceptions? PinmemberAlexander Shilonosov5:06 23 Jun '05  
Generalcreating directory Pinmemberhadaf923:42 17 Apr '05  
GeneralRe: creating directory PinmemberAlexander Shilonosov20:17 18 Apr '05  
GeneralRe: creating directory Pinmemberquentinsiraut5:17 19 Apr '05  
GeneralTelnet and RCMD Pinmemberquentinsiraut8:12 15 Apr '05  
GeneralRe: Telnet and RCMD PinmemberAlexander Shilonosov20:33 15 Apr '05  
GeneralRe: Telnet and RCMD Pinmemberquentinsiraut5:20 19 Apr '05  

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

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

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120529.1 | Last Updated 27 Jan 2004
Article Copyright 2004 by Alexander Shilonosov
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid