HOWTO: Keep a Windows CE Device Alive while Communicating

Last reviewed: February 11, 1998
Article ID: Q180898
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows CE, versions 1.0, 1.01
    

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 : BseMisc
Version : WINNT:1.0,1.01
Platform : winnt
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 11, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.