Microsoft KB Archive/69545

DOS Idle Interrupts and Word for Windows Article ID: Q69545 Revision Date: 13-SEP-1995

The information in this article applies to:


 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c

SUMMARY Microsoft Windows calls the PeekMessage function when it is idle and does not allow DOS Idle Interrupts (interrupt 28h) to be called. This creates problems when a memory resident program is written to contain an interrupt 28h handler that is executed repeatedly while DOS is waiting for an event such as keyboard output. Word for Windows does not allow this call to be made by the memory resident program.

MORE INFORMATION DOS executes interrupt 28h within services that loop while waiting for an expected event. Executing interrupt 28h normally does nothing, but a memory resident program can be written to contain an interrupt 28h handler that is executed repeatedly while DOS is waiting for an event such as keyboard output. Each time an input event occurs in an application such as when the mouse moves or a keyboard key is depressed, Windows generates a message. These messages are collected and placed in an application’s queue. An application can pull messages from its queue, using the GetMessage function. If the queue is empty, the GetMessage function waits for a message to be placed in the queue. If a message exists in the queue, GetMessage returns the top message. While waiting for a message, GetMessage gives control back to Windows, allowing other applications to process their messages. The WaitMessage function also yields control to other applications when there are no messages in the queue. This function suspends the application and does not return until a new message is placed in the application’s queue. PeekMessage is used by an application to check the queue for a message but does not pull the message from the queue. If no messages are present, PeekMessage allows the application to yield control because PeekMessage itself yields if no messages are in the queue. But PeekMessage does not wait for a message to be placed in the queue before returning to the application. Word for Windows calls the PeekMessage function when it is idle instead of calling GetMessage or WaitMessage. This allows Word to blink the cursor. Because PeekMessage was used, no interrupt 28h calls can occur when Word for Windows is running. In particular, this affects memory resident programs that attempt to execute an interrupt 28h handler.

Reference(s):

“Microsoft Windows Software Development Kit Reference,” version 3.0, pages 4-413, 4-422, 4-165, 4-166, 4-288, 4-289 “The New Peter Norton Programmer’s Guide to the IBM PC and PS/2,” page 312

KBCategory: kbother KBSubcategory: Additional reference words: winword winword2 1.0 1.1 1.1a 1.00 1.10 1.10a 2.0 2.00

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 1995.