SAMPLE: Hot Keys in Windows 386 Enhanced ModeLast reviewed: February 15, 1996Article ID: Q89494 |
The information in this article applies to:
SUMMARYSome Windows-based applications implement shortcut ("hot") keys by establishing a Windows hook that scans the stream of keystrokes typed and responds to the hot key. While this technique works correctly within the Windows system virtual machine in 386 enhanced mode, the hot key will not be recognized while an MS-DOS virtual machine (VM) has the focus because the keystroke will not be visible to the Windows system virtual machine. In order to define a "global" hot key that is active even while an MS-DOS- based application is running, a virtual device (VxD) must be written to perform this task. This article describes the steps for writing such a VxD.
MORE INFORMATIONThere is a sample VxD called VHOTKEYD in the Software/Data Library that demonstrates the steps necessary to reflect a hot key into the system virtual machine. VHOTKEYD sets up a global hot key through the VKD_Define_Hot_Key service. The hot key handler schedules a system-VM- specific event that will force the focus to the system VM through the System_Control service and force the keystroke into the system VM through the VKD_Reflect_Hot_Key service. Instead of the VKD_Reflect_Hot_Key service, the VKD_Force_Keys service could be used; however, in that case the hot key handler must explicitly call VKD_Cancel_Hot_Key_state; furthermore, the hot key must be defined with the Local_key option and must be locally disabled for the system VM. The advantage of using VKD_Force_Keys is that the hot key is inserted into the VM's virtual keyboard buffer so that keystrokes submitted before the hot key will still be processed in the VM's context. In any case, a switch to the system virtual machine will not take place if a) the virtual machine being switched away from is in a critical section, or b) that virtual machine runs exclusively. VHOTKEYD uses the VKD_Force_Keys technique. Download VHOTKEYD.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:
|
Additional reference words: 3.00 3.10 softlib VHOTKEYD.EXE
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |