Microsoft KB Archive/74528

{|
 * width="100%"|

INFO: &quot;Power-Friendly&quot; Applications

 * }

Q74528

3.00 3.10 WINDOWS kbprg

-

The information in this article applies to:


 * Microsoft Windows Software Development Kit (SDK) 3.1

-

SUMMARY
Power-managed personal computers, such as some battery-powered notebook computers, are designed to conserve power during periods of CPU inactivity or &quot;idle time.&quot; Although most power-saving measures should occur transparently to an application, developers should be aware of several attributes that make an application &quot;power friendly.&quot;

To qualify as &quot;power-friendly,&quot; an application must use the PeekMessage and Yield functions carefully, preferably only for temporary background tasks. As long as an application is in a PeekMessage loop, the Windows system cannot go idle. Therefore, an application should not remain in a PeekMessage loop after its background processing has completed.

MORE INFORMATION
Traditionally, an application running in the Windows multitasking environment needed only to ensure that once it was finished with its processing it yielded the processor to other applications in the system. However, the increased popularity of battery-powered systems imposes another responsibility on applications: to allow Windows to &quot;go idle&quot; as often as possible.

To Windows, the system appears idle when all executing programs are awaiting input. All applications have called the GetMessage or WaitMessage function, and no pending messages are in any application queue. At such times, the Windows kernel broadcasts an idle notification by using an MS-DOS interrupt. A power-managed PC can use this notification as a signal to take power-saving measures.

When an application is in a PeekMessage or Yield loop, it prevents Windows from going idle, thus thwarting attempts by power-managed PCs to save power.

An application's main message handler should use a GetMessage loop or equivalent structure (such as the combined use of the PeekMessage and WaitMessage functions) when no background processing is required. This allows Windows to go idle and power-saving measures to take effect.

Applications that must periodically service a task (for example, a communications connection) should poll, in response to a message from a timer, if there is no other way to determine when the status of the device changes.

Additional query words: 3.00 3.10 APM

Keywords : kb16bitonly kbSDKPlatform kbSysSettings

Issue type : kbinfo

Technology : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK310