PowerAwareApp question...

  • Thread starter Thread starter Brian H
  • Start date Start date
B

Brian H

Alex,

I have a question for you on the PowerAwareApp code you've written.

In the WaitForProc method, the last two lines:
CloseHanlde(hQueue);
CloseHanlde(m_hEvtQuit);

Seem to always throw MissingMethodExceptions when exiting the app. Any
ideas why? I was thinking that maybe the form was already disposed of at
the time, or some other threading-related issue.

Second:
As you've written it out of the box, it works well for picking up states
such as PowerOn. Do you know if it's possible to detect an "OFF_AC" state
(such as taking the device out of the cradle)?

If not, I can see that there's an unsupported NOTIFICATION_EVENT (with a
value of 4) for CeRunAppAtEvent that can handle "on" or "off" AC power. I
was thinking if the above weren't possible, I could perhaps use this
somehow -- if the app is already running when CeRunAppAtEvent is fired, I
know it just brings focus to the application; is it possible to capture a
sender or otherwise have the app figure it why it was focused?

Thank you again for your help,
Brian
 
Try PBT_POWERSTATUSCHANGE - it should be fired when you move from AC to DC
and back.
As for the exception, which one of those two lines causes it? The second one
actually should be removed
 
Thanks Alex-- Got it working fine!

As for the exception -- actually it was happening on either... weird. I'll
look into it a bit more, but many thanks for the code sample...

Brian
 
Back
Top