HOWTO: Keep a Windows CE Device Alive while Communicating

ID: Q180898

The information in this article applies to:

SUMMARY

When you are doing serial communications, a device may suspend power based upon a time limit configured by the user. The operating system determines idle time based only upon any type of keyboard entry on the device. This article explains how to keep a Windows CE device alive while you are communicating.

MORE INFORMATION

To avoid device suspension, an application may send a key stroke using keybd_event(). You need to send a UP keystroke to prevent a keyboard click from occurring. You should send a key that is currently not being used by the Windows CE operating system so that you can eliminate any potential keyboard conflict. In the following example, an F4 UP keystroke is sent:

   keybd_event(VK_F4, 0, KEYEVENTF_KEYUP,0);

To determine the time limit that has been configured by the user, you can query the following registry key:

   HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\BattPowerOff

The BattPowerOff value is a DWORD that represents how long (in seconds) the HPC device will wait before suspending itself.

Additional query words: Advanced Power Management Sleep

Keywords          : kbWinCE 
Version           : WINNT:1.0,1.01
Platform          : winnt
Issue type        : kbhowto

Last Reviewed: July 3, 1998