Microsoft KB Archive/62359

INF: Sample PM Program That Monitors Hot Keys PSS ID Number: Q62359 Article last modified on 09-06-1991 PSS database name: P_PresMan

1.21

OS/2

Summary:

The following information describes how to create a Presentation Manager (PM) application that is minimized and idle until a hot key is pressed. After the hot key is recognized, the application is restored. It then performs some kind of interaction with the user, and goes to sleep again.

The best way to do this is to install a system input hook to monitor the keyboard or mouse event. When the hot key is intercepted, the input hook can send the application a message to wake it up.

There is a sample application in the Software/Data Library named ANK that installs and releases a system input hook. On the System Input Hook menu in ANK, the “install” item installs the system input hook that monitors the WM_CHAR and WM_MOUSE1DBLCLK messages. When these two messages pass by, a beep is generated. In addition, a WM_COMMAND message will be sent to the application to restore it and bring it into focus when a WM_MOUSE1DBLCLK message passes by. The input hook is implemented as a DLL (dynamic-link library), therefore, HOOK.DLL should be included in the user’s LIBPATH system setting when using ANK.

ANK can be found in the Software/Data Library by searching on the word ANK, the Q number of this article, or S12593. ANK was archived using the PKware file-compression utility.

To demonstrate how ANK works, do the following:


 * 1) Run ANK.
 * 2) Install the system input hook.
 * 3) Minimize the sample application.
 * 4) Double-click the left mouse button. This restores the application and brings it into focus.
 * 5) Remove the system input hook.
 * 6) Quit.

Copyright Microsoft Corporation 1991.