DOCUMENT:Q96422 06-NOV-1999 [win16sdk] TITLE :Detecting Idle Time in Windows PRODUCT :Microsoft Windows Software Development Kit PROD/VER:WINDOWS:3.1 OPER/SYS: KEYWORDS:kb16bitonly ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Windows Software Development Kit (SDK) 3.1 ------------------------------------------------------------------------------- SUMMARY ======= When the system goes idle under Microsoft Windows version 3.1, Kernel issues a single Interrupt 2Fh function 1689h call. This interrupt can be used by a Windows-based application to detect idle time. MORE INFORMATION ================ Listed as "Windows kernel idle call" in the INT2FAPI.INC file of the Windows Device Development Kit (DDK) version 3.1, Interrupt 2Fh function 1689h is the system-idle notification. To be notified when the system becomes idle, a Windows-based application must put an interrupt service routine (ISR) in the Interrupt 2Fh chain using the MS-DOS Set Interrupt Vector call (Interrupt 21h function 25h), and look for AX register equal to 1689h. The ISR must call the address of the old handler to pass the control down the Interrupt 2Fh chain. The address of the old handler can be retrieved using the MS-DOS Get Interrupt Vector call (Interrupt 21h function 35h). The ISR must be part of a device driver, dynamic-link library (DLL), or installable device driver. Furthermore, the ISR is required to be in a fixed segment. This can be accomplished by marking the segment of the ISR as PRELOAD FIXED in the module definition (.DEF) file for the DLL. Hooking Interrupt 2Fh function 1689h to detect idle time can result in performance degradation. Therefore, if a Windows-based application only needs to perform background processing, it must use the PeekMessage() and WaitMessage() functions. Only those applications that need to detect idle time (for example, benchmarking applications) should use Interrupt 2Fh. Additional query words: 3.10 ====================================================================== Keywords : kb16bitonly Technology : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK310 Version : WINDOWS:3.1 ============================================================================= 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. Copyright Microsoft Corporation 1999.