Compartir a través de


CKeyboardManager Class

Manages shortcut key tables for the main frame window and child frame windows.

class CKeyboardManager : public CObject

Members

Public Constructors

Name

Description

CKeyboardManager::CKeyboardManager

Constructs a CKeyboardManager object.

Public Methods

Name

Description

CKeyboardManager::CleanUp

Clears the shortcut key tables.

CKeyboardManager::FindDefaultAccelerator

Retrieves the default shortcut key for the specified command and window.

CKeyboardManager::IsKeyHandled

Determines whether a key is handled by the accelerator table.

CKeyboardManager::IsKeyPrintable

Indicates whether a character is printable.

CKeyboardManager::IsShowAllAccelerators

Indicates whether menus show all shortcut keys for a command or only the default shortcut key.

CKeyboardManager::LoadState

Loads the shortcut key tables from the Windows registry.

CKeyboardManager::ResetAll

Reloads the shortcut key tables from the application resource.

CKeyboardManager::SaveState

Saves the shortcut key tables to the Windows registry.

CKeyboardManager::ShowAllAccelerators

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.

CKeyboardManager::TranslateCharToUpper

Converts a character to its upper register.

CKeyboardManager::UpdateAccelTable

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 Custom Pages sample.

    // The GetKeyboardManager method is inherited from the CWinAppEx class.
    CKeyboardManager* cKeyboardManager = GetKeyboardManager();
    cKeyboardManager->ShowAllAccelerators();

Inheritance Hierarchy

CObject

   CKeyboardManager

Requirements

Header: afxkeyboardmanager.h

See Also

Reference

Hierarchy Chart

CWinAppEx Class

CWinAppEx::InitKeyboardManager

Concepts

Keyboard and Mouse Customization

Other Resources

MFC Classes