[PythonCE] How do you develop on the PocketPC?

Thomas Heller theller at python.net
Wed Jan 11 17:19:07 CET 2006

"Luke Dunstan" <coder_infidel at hotmail.com> writes:

>>> From: "Thomas Heller" <theller at python.net>
>> Do you know of any other way except TCP/IP to establish a two-way
>> communication between the desktop and the PDA?
> One way I know is using the CeRapiInvoke() API, which is a kind of remote 
> procedure call:
> STDAPI_( HRESULT ) CeRapiInvoke(
>   LPCWSTR pDllPath,
>   LPCWSTR pFunctionName,
>   DWORD cbInput,
>   BYTE * pInput,
>   DWORD * pcbOutput,
>   BYTE ** ppOutput,
>   IRAPIStream ** ppIRAPIStream,
>   DWORD dwReserved
> );
> You can specify a DLL and function name and the device-side part of RAPI 
> will load the DLL and call the function, but it must have the following 
> prototype (see also wincerapi.py):
>   DWORD cbInput,
>   BYTE * pInput,
>   DWORD * pcbOutput,
>   BYTE ** ppOutput,
>   IRAPIStream * pIRAPIStream
> );
> In block mode (ppIRAPIStream == NULL) you can simply pass a block of data in 
> each direction. The interesting part is that if you pass a pointer then you 
> will receive a IRAPIStream* that allows the device and PC to communicate in 
> both directions similar to a socket.
> I have tested this in one direction only using the CeInvoke sample from the 
> Pocket PC 2003 SDK, and I also tested replacing the desktop-side program 
> with a Python script. However, so far this API does not seem robust; for 
> example if the device-side DLL releases the stream then IRAPIStream::Read() 
> seems to block forever in the desktop program. The CeInvoke sample handles 
> this by sending a command over the stream to let the desktop know that it 
> has finished, but to my mind it is a hack because it would be like sending a 
> disconnect command over a TCP socket and relying on that to shut down the 
> other end. The function IRAPIStream::SetRapiStat can supposedly set a 
> timeout for Read() but so far I can't get it to work. There is a two-way 
> stream sample in an MSDN KB article that I have yet to try.
> For creating development tools there is also the possibility of using the 
> Platform Manager APIs, which are installed and used by eMbedded Visual C++ 
> to communicate with the remote debugger, among other things. Platform 
> Manager supports multiple "transports" including TCP/IP and ActiveSync and 
> you can even create your own transport. I haven't actually tried using it 
> yet though :-).

This is useful info, I'm sure I need it when I have time;-)



More information about the PythonCE mailing list