detecting power on

M

Mortar

ok, i know how to run an app on power on with cerunappatevent. But, i
would like to know if i have an app already running, how do i call a
function if they power on.

So for example, the program is running, they turn the pda off, then
they turn the pda on again. I need to do something when they turn it
on again, but not run an app, just call a function.
 
C

Chris Tacke, eMVP

Use a power notification. CeRunAppAtEvent can also set a system event.

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
 
M

Mortar

well here is my code to run my app on power up:
bool bRet = CeRunAppAtEvent(@"\Program Files\myapp\myprogram.exe",
NOTIFICATION_EVENT_WAKEUP)

how would i change it to call a function?
 
M

Mortar

ive tried that link several times and it always times out


Alex Feinman has written an example which demonstrates how to receive
power notifications and display a login dialog when the system is woken up:
http://www.alexfeinman.com/download.asp?doc=PowerAwareApp.zip


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

ok, i know how to run an app on power on with cerunappatevent. But, i
would like to know if i have an app already running, how do i call a
function if they power on.

So for example, the program is running, they turn the pda off, then
they turn the pda on again. I need to do something when they turn it
on again, but not run an app, just call a function.
 
C

Chris Tacke, eMVP

Change the program name to "\\\\.\\Notifications\\NamedEvents\\Event Name".
Of course you'll have to create a EventWaitHandle with an explicit name that
matches the "Event Name". It will get signalled on wake.

The other option is to follow Sergey's advice to look at Alex's sample.

--
Chris Tacke
Co-founder
OpenNETCF.org
Are you using the SDF? Let's do a case study.
Email us at d c s @ o p e n n e t c f . c o m
http://www.opennetcf.org/donate
 
A

Alex Feinman [MVP]

The web site is down for the next week or so. Email me

Mortar said:
ive tried that link several times and it always times out


Alex Feinman has written an example which demonstrates how to receive
power notifications and display a login dialog when the system is woken
up:
http://www.alexfeinman.com/download.asp?doc=PowerAwareApp.zip


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

ok, i know how to run an app on power on with cerunappatevent. But, i
would like to know if i have an app already running, how do i call a
function if they power on.

So for example, the program is running, they turn the pda off, then
they turn the pda on again. I need to do something when they turn it
on again, but not run an app, just call a function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top