Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 180898 - Last Review: November 21, 2006 - Revision: 3.3
How To Keep a Windows CE Device Alive while Communicating
This article was previously published under Q180898
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.
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 Handheld PC will wait before suspending itself. There are two methods to prevent this
suspension.
Method 1
To avoid device suspension, an application can send a keystroke using
keybd_event(). Even sending an UP keystroke, you may still get a keyboard click,
so use KEYEVENTF_SILENT to prevent the 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 | KEYEVENTF_SILENT, 0);
Method 2
A better solution is to use the API SystemIdleTimerReset() from Coredll.dll. This
does not disable the timeout, but resets the idle timer count back to zero. Since
the minimum idle timer you can set is one minute, calling this API at intervals of
less than one minute will prevent the device from entering suspend mode.
APPLIES TO
- Microsoft Win32 Application Programming Interface, when used with:
Retired KB Content DisclaimerThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please