Sven Barth wrote:
Hello together!
2009/12/16 "Arí Ricardo Ody" <aro52 at gmx.com8>
Suppose you connect a Handheld running windows mobile via USB cable to a
windows machine.
Is there a way that I can recognize the new disk added to the system,
e.g.,
determine what of the disks existing in the windows machine is the disk
added when I connected the handheld?
As far as I know a Windows Mobile device is not recognized as a real
volume or disk. That directory you see in Windows Explorer is a
virtual directory which relies on the Remote API (RAPI) to communicate
with the device and to display/modify its contents.
I also tested the WM_DEVICECHANGE approach: it is not working (as
expected by me) - but it works well with an SD card...
There are two possibilities you can handle this:
* Try to connect with RAPI to your device. You can call the init
function with an Event, that will be set once a device shows up (or an
error happens). You need to use WaitForSingleObject for this.
* Add an entry to "HKLM\Software\Microsoft\Windows CE
Services\AutoStartOnConnect" which contains an application (Name:
Something, Value: your application path + parameters), that will be
started once an ActiveSync connection is established. This application
can for example notify your main application about this event. There
is also an AutoStartOnDisconnect key containing applications that will
be started once a device has been disconnected. (These keys also exist
on Vista with Windows Mobile Device Center installed)
Note: for working with the file system of a Windows Mobile device you
ALWAYS need to use RAPI (well... except you "export" the storage card
of your device with WM5torage).
Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Hi,
It depends how your device connects to the PC.
I'm developing some little apps for PNA (personal navigation) lately.
Some of them will add new drive to the system (most of them will add two
new drives, internal flash and external SD card), but some uses
ActiveSync to communicate with PC.
I didn't work a lot with the latter one, and for these which are adding
new drives to Explorer - there WM_DEVICECHANGE works just fine.
regards
bobby
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus