Click here to Skip to main content
Click here to Skip to main content

Command-line utility for PocketPC

By , 26 Jan 2004
 

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
No Biography provided

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.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralSystem informationmemberMelkske19753 Jun '10 - 21:11 
Hi,
 
Is it also possible via Rapi to retrieve system information of the connected device like : the serial number of the device ?
 
Regards
Geert
GeneralThanksmemberAlexander Gorshkov17 Jan '09 - 6:43 
Спасибо, Александр, очень полезная программа!
Thanks a lot!Wink | ;-)
GeneralBuffer overunmemberMember 41451287 Mar '08 - 20:23 
This is a great program and I am finding it very helpful.
Thanks Alexander.
 
Am I right in saying that in Rapi1.cpp
 
LPCTSTR itoaFileSize(DWORD size, LPTSTR out = NULL)
{
... TCHAR postfix[5];
 
Needs to be
 
... TCHAR postfix[6];
 
to make room for the string delimiter after "bytes"?
 
Martin
GeneralCopyingmemberfdgf16 Dec '07 - 11:20 
Hello,
 
Your application copies files a lot slower than active synch, any idea why?
 
Thanks!
danutz_cr

Generalwhy buffer size is 5006memberAgunJ27 Aug '07 - 22:51 
Hi Alexander,
 
Thank you.
Why you use 5006 as the buffer size in CopyFile1 and CopyFile2.
D'Oh! | :doh:
 
CODE with me

QuestionSD card directorymemberugroczkycs14 Nov '06 - 3:22 
I'd like to copy files to PPCs SD card, how can i find SD card directory?
thanx
AnswerRe: SD card directorymemberAlexander Shilonosov15 Nov '06 - 2:57 
Sorry I cannt help you. Because now I am using non MS device.
 
--
Alexander Shilonosov

Questionpossible to convert to vb .netmemberathinarayanan2 Nov '06 - 3:26 
Hi this is really great tool. however, I would like to have this in vb .net version of it.
is anyone can convert will be great.

GeneralBug fix : memory leak [modified]memberVincent_RICHOMME10 Jul '06 - 4:56 
Hi, there is a bug in Rapi1.cpp in itoaFileSize
 
In debug mode and when transferring big files I got stack corruption.
Postfix variable should be declared as an array > 5 because bytes needs 6 car to be stored : 5+ backslash 0
I have declared it as an array of 64 elements and it seems to fix all my issues.
 

 

 

QuestionHow to add to "Send to" meu ??memberjulian_hung9 Jun '06 - 23:47 
Hi,
This is a great tool, I love it. I used it all the time when I want to copy files from PC to PPC.
 
You mentioned you have add this to "Send To" menu.
Could you share with us how you do it ??
 
Thanks.

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

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