GetInputState Is Faster Than GetMessage or PeekMessageLast reviewed: November 2, 1995Article ID: Q35605 |
The information in this article applies to:
SUMMARYThis article describes a method to quickly determine whether an application for the Microsoft Windows graphical environment has any keyboard or mouse messages in its queue without calling the GetMessage or PeekMessage functions. NOTE: In Win32, GetInputState is thread-local only.
MORE INFORMATIONThe GetInputState function returns this information more quickly than GetMessage or PeekMessage. GetInputState returns TRUE (nonzero) if either a keyboard or mouse message is in the application's input queue. If the application must distinguish between a mouse and a keyboard message, GetInputState returns the value 2 for a keyboard and the value 1024 for a mouse message. Because difficulties may arise if the application loses the input focus, use GetInputState only in tight loop conditions where execution speed is critical. In Win32, message queues are not global as they are in 16-bit Windows. The message queues are local to the thread. When you call GetInputState, you are checking to see if there are mouse or keyboard messages for the calling thread only. If a window created by another thread in the application has the keyboard input waiting, GetInputState will not be able to check for those messages.
|
Additional reference words: 3.00 3.10 3.50 4.00 95 yield
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |