Hi everybody, I found a couple of ways to do this: METHOD 1: Using OpenNETCF's WinAPI library ------------- Below solution was provided by Maarten Struys, eMVP, PTS Software in http://www.opennetcf.org/Forums/topic.asp?TOPIC_ID=1307: Using OpenNETCF's WinAPI
library you can call Core.SendKeyboardKey(), where you should define VK_OFF as 0xDF. So it would be something like this: using OpenNETCF.WinAPI; . . private void button1_Click(object sender, System.EventArgs e) { const byte VK_OFF = 0xDF; Core.SendKeyboardKey(VK_OFF);
// at this moment the device is powered down. Be aware that we resume running from here // once the device is powered up again. } METHOD 2: Using Platform Invoke mechanism ------------- private const byte VK_OFF = 0xDF; private const byte KEYEVENTF_SILENT
= 0x0004; private const byte KEYEVENTF_KEYUP = 0x0002; [DllImport("coredll.dll")] private static extern void keybd_event(byte bVK, byte bScan, uint dwFlags, uint dwExtraInfo); private void button1_Click(object sender, System.EventArgs e) { keybd_event(VK_OFF,0,KEYEVENTF_SILENT,0);
keybd_event(VK_OFF,0,KEYEVENTF_SILENT | KEYEVENTF_KEYUP,0); }
Spaoind
Member
90 Points
18 Posts
How to Suspend Pocket PC in the program?
Feb 05, 2004 07:51 PM|LINK
Spaoind
Member
90 Points
18 Posts
Re: How to Suspend Pocket PC in the program?
Feb 09, 2004 08:34 PM|LINK