HotKeyed.exe Creates a Shortcut-Key Edit Control (83914)
The information in this article applies to:
- Microsoft Windows Software Development Kit (SDK) 3.1
This article was previously published under Q83914 SUMMARY
HotKeyed.exe is a sample that demonstrates how to implement a shortcut-key
edit control so a user can define a shortcut key for your application. When
the user presses the shortcut key, Windows activates the corresponding
application.
MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center: HotKeyed.exe
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
HotKeyed.exe demonstrates how an application can implement a shortcut-key
(hot key) edit control. The application contains a dialog box in which
the user can specify which shortcut key the application will use. This
dialog box uses a subclassed edit control to display the name of the
shortcut key entered by the user. The edit control verifies that the
shortcut key is valid before displaying its name, and the control does
not permit the user to enter an invalid shortcut key. HOTKEYED calls
the GetKeyNameText function to retrieve the names of the specified
keys.
After the user enters a valid shortcut key, the application will
install the shortcut key. Hotkeyed.exe installs a shortcut key by calling
the SetWindowsHookEx function to install a task-specific keyboard
hook. The application provides a menu selection to remove the shortcut
key. Closing the application also removes the shortcut key.
Once the shortcut key is installed, the application's window caption
flashes to inform the user that a shortcut key is active. The caption
continues to flash until the shortcut key is removed. When the user
presses the shortcut key, the background color of the main window
changes.
A shortcut key must use the ALT key and/or the CTRL key as a modifier.
The SHIFT key can also be specified as a modifier, but only in
combination with the ALT and/or CTRL keys. The ESC, ENTER, TAB, and
PRINT SCREEN keys and the SPACEBAR are not valid shortcut keys.
The user can erase a key combination from the shortcut key edit
control with the BACKSPACE key. Alternatively, the user can enter a
different shortcut key.
Modification Type: | Minor | Last Reviewed: | 8/30/2004 |
---|
Keywords: | kb16bitonly kbfile kbInput kbSample KB83914 kbAudDeveloper |
---|
|