CKeyboardManager Class
Manages shortcut key tables for the main frame window and child frame windows.
class CKeyboardManager : public CObject
Members
Public Constructors
Name |
Description |
Constructs a CKeyboardManager object. |
Public Methods
Name |
Description |
Clears the shortcut key tables. |
|
Retrieves the default shortcut key for the specified command and window. |
|
Determines whether a key is handled by the accelerator table. |
|
Indicates whether a character is printable. |
|
Indicates whether menus show all shortcut keys for a command or only the default shortcut key. |
|
Loads the shortcut key tables from the Windows registry. |
|
Reloads the shortcut key tables from the application resource. |
|
Saves the shortcut key tables to the Windows registry. |
|
Specifies whether the framework displays all the shortcut keys for all commands, or a single shortcut key for each command. This method does not affect commands that have only one associated shortcut key. |
|
Converts a character to its upper register. |
|
Updates a shortcut key table with a new shortcut key table. |
Remarks
The members of this class enable you to save and load shortcut key tables to the Windows registry, use a template to update the short cut key tables, and find the default shortcut key for a command in a frame window. In addition, the CKeyboardManager object lets you control how shortcut keys are displayed to the user.
You should not create a CKeyboardManager object manually. It will be created automatically by the framework of your application. However, you should call CWinAppEx::InitKeyboardManager during the initialization process of your application. To get a pointer to the keyboard manager for your application, call CWinAppEx::GetKeyboardManager.
Example
The following example demonstrates how to retrieve a pointer to a CKeyboardManager object from a CWinAppEx class, and how to show all the shortcut keys associated with menu commands. This code snippet is part of the CustomPages Sample: MFC Toolbar Customization Dialog Application.
// The GetKeyboardManager method is inherited from the CWinAppEx class.
CKeyboardManager* cKeyboardManager = GetKeyboardManager();
cKeyboardManager->ShowAllAccelerators();
Inheritance Hierarchy
Requirements
Header: afxkeyboardmanager.h
See Also
Concepts
Keyboard and Mouse Customization
Reference
CWinAppEx::InitKeyboardManager