How to turn OFF a pocket pc device?

G

Guest

Hi, How can I turn off a pocket pc device with visual c#.net? I only found a
solution for embedded visual c++...please help me. Thank you

juvi
 
S

Sergey Bogdanov

Try this:


using System.Runtime.InteropServices;
....

[DllImport("coredll.dll")]
private static extern void PowerOffSystem();
 
G

Guest

Hi,

it works, but is it a save way to power off? I tested it on a HP iPAQ
HX4700. If I power off the device with this code, then you can see the
display getting darker and darker. If you you use e.g.: Battery Pack Pro to
power off, then the display is powered off immediately. What do you think
about this?

juvi

Sergey Bogdanov said:
Try this:


using System.Runtime.InteropServices;
....

[DllImport("coredll.dll")]
private static extern void PowerOffSystem();


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

Hi, How can I turn off a pocket pc device with visual c#.net? I only found a
solution for embedded visual c++...please help me. Thank you

juvi
 
S

Sergey Bogdanov

Well, you may try to turn it off by sending VK_OFF key. After that a
device will be turned off immediately:


keybd_event(VK_OFF, 0, 0, 0);
keybd_event(VK_OFF, 0, KEYEVENTF_KEYUP, 0);


....

const int KEYEVENTF_KEYUP = 2;
const int VK_OFF = 0xDF;

[DllImport("coredll.dll")]
private static extern void keybd_event(byte bVk, byte bScan, int
dwFlags, int dwExtraInfo);



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

Hi,

it works, but is it a save way to power off? I tested it on a HP iPAQ
HX4700. If I power off the device with this code, then you can see the
display getting darker and darker. If you you use e.g.: Battery Pack Pro to
power off, then the display is powered off immediately. What do you think
about this?

juvi

:

Try this:


using System.Runtime.InteropServices;
....

[DllImport("coredll.dll")]
private static extern void PowerOffSystem();


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

Hi, How can I turn off a pocket pc device with visual c#.net? I only found a
solution for embedded visual c++...please help me. Thank you

juvi
 

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