Page 1 of 1
Power up/down on ppc

Posted:
May 9, 2002 @ 7:49pm
by angedelamort

Posted:
May 9, 2002 @ 8:53pm
by Dan East
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

Posted:
May 9, 2002 @ 8:55pm
by 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

Posted:
May 9, 2002 @ 9:02pm
by angedelamort
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!