Share via


How to: Suspend the Device

Applications can cause the device to suspend by simulating a press of the Power key, which makes two calls to the Windows CE keybd_event function, as shown in the following code:

keybd_event(VK_OFF,0,KEYEVENTF_SILENT,0);
keybd_event(VK_OFF,0,KEYEVENTF_SILENT | KEYEVENTF_KEYUP,0);
sleep(60);

The sleep statement allows time for the system to suspend and prevents your application from executing further.

See Also

Handling Low Memory States

How to: Determine Available Memory

How to: Determine Battery Status

How to: Prevent Automatic Power Down

How to: Program Applications to Turn the Smartphone Backlight Off and On

Managing Variables, Stacks, and Heaps on Mobile Devices

Memory and Power Management

Memory Status and Information

System Out of Memory Dialog Box

Last updated on Friday, April 22, 2005

© 2005 Microsoft Corporation. All rights reserved.

Send feedback on this topic to the authors.