Microsoft KB Archive/40341

INF: How PM Handles Keyboard/Mouse I/O from Keyboard PSS ID Number: Q40341 Article last modified on 08-20-1991 PSS database name: P_PresMan

1.03 1.05 1.06 1.10

OS/2

Summary:

The following are questions regarding keyboard and mouse I/O from the keyboard:

  Q. How does Presentation Manager (PM) perform I/O from the keyboard and mouse? Does it work through the device driver using IOCTL? A. The mouse and keyboard device drivers each call an entry point in the PMDD.SYS device driver at interrupt time to inform the PMDD.SYS driver that an event has occurred. The PMDD.SYS driver then places the event on the system message queue as a CHAR or MOUSE type of message, depending on the event.   Q. Is there any way to intercept input from the keyboard/mouse before it gets to PM (such as a device monitor), other than to write new keyboard and mouse device drivers? A. Yes. You can catch the events by using the hook capabilities of PM. This allows you to intercept the messages on the queue before they reach an application’s window procedure. To do this, you can set up an input hook (either for a specific queue or system wide) and watch the messages as they come through. 

For information on how to use hooks, see the sample program named HOOKTEST in the Software/Data Library. HOOKTEST can be found in the Software/Data Library by searching on the keyword HOOKTEST, the Q number of this article, or S12173. HOOKTEST was archived using the PKware file-compression utility.

Copyright Microsoft Corporation 1991.