Hi,
I've got another great question:
Is wince send any events when the unit power down and power up?
If not, is there a way to detect it? I have a solution, but don't like it.
TIA
Well, I don't know if Pocket PC 2002 added the capability or not. My understanding is that the only way to do it is to take control of the com port as a driver of some sort, which is then notified of power events. An excerpt from the topic "Programming in the Suspend State":
WaitCommEvent Waits for a communications event to occur. Serial, Infrared Data Association (IrDA), or PC Card storage devices can return EV_POWER when the device resumes operation.
Dan East
Another indirect method is to create a timer (WM_TIMER) for say 5 seconds. Each time the event fires check how long since the last event occured. If it has been more than say 10 seconds (which allows for the system to grind to a halt as it does on occasion), you know the device was suspended.
Dan East
Thanks,
the first one seem interesting, but i think you need to specify an absolute path, so if someone change the app to another location, it will crash or display an error msg I think.
I'm using the second method for now, with a timer of 2 seconds. It works fine, but if you play with power button, it will not work :(
Thanks M$ for this great API lol
and this time for real, thanks Dan!