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

Re: How to turn OFF a pocket pc device? by Sergey

Sergey
Sun Aug 07 05:11:50 CDT 2005

Try this:


using System.Runtime.InteropServices;
...

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


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


juvi wrote:
> 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

Re: How to turn OFF a pocket pc device? by juvi

juvi
Sun Aug 07 06:33:03 CDT 2005

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" wrote:

> Try this:
>
>
> using System.Runtime.InteropServices;
> ....
>
> [DllImport("coredll.dll")]
> private static extern void PowerOffSystem();
>
>
> --
> Sergey Bogdanov [.NET CF MVP, MCSD]
> http://www.sergeybogdanov.com
>
>
> juvi wrote:
> > 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
>

Re: How to turn OFF a pocket pc device? by Sergey

Sergey
Sun Aug 07 07:19:18 CDT 2005

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


juvi wrote:
> 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" wrote:
>
>
>>Try this:
>>
>>
>>using System.Runtime.InteropServices;
>>....
>>
>>[DllImport("coredll.dll")]
>>private static extern void PowerOffSystem();
>>
>>
>>--
>>Sergey Bogdanov [.NET CF MVP, MCSD]
>>http://www.sergeybogdanov.com
>>
>>
>>juvi wrote:
>>
>>>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
>>