共用方式為


CHotKeyCtrl Class

Provides the functionality of the Windows common hot key control.

class CHotKeyCtrl : public CWnd

Members

Public Constructors

Name

Description

CHotKeyCtrl::CHotKeyCtrl

Constructs a CHotKeyCtrl object.

Public Methods

Name

Description

CHotKeyCtrl::Create

Creates a hot key control and attaches it to a CHotKeyCtrl object.

CHotKeyCtrl::CreateEx

Creates a hot key control with the specified Windows extended styles and attaches it to a CHotKeyCtrl object.

CHotKeyCtrl::GetHotKey

Retrieves the virtual key code and modifier flags of a hot key from a hot key control.

CHotKeyCtrl::GetHotKeyName

Retrieves the key name, in the local character set, assigned to a hot key.

CHotKeyCtrl::GetKeyName

Retrieves the key name, in the local character set, assigned to the specified virtual key code.

CHotKeyCtrl::SetHotKey

Sets the hot key combination for a hot key control.

CHotKeyCtrl::SetRules

Defines the invalid combinations and the default modifier combination for a hot key control.

Remarks

A "hot key control" is a window that enables the user to create a hot key. A "hot key" is a key combination that the user can press to perform an action quickly. (For example, a user can create a hot key that activates a given window and brings it to the top of the Z order.) The hot key control displays the user's choices and ensures that the user selects a valid key combination.

This control (and therefore the CHotKeyCtrl class) is available only to programs running under Windows 95/98 and Windows NT version 3.51 and later.

When the user has chosen a key combination, the application can retrieve the specified key combination from the control and use the WM_SETHOTKEY message to set up the hot key in the system. Whenever the user presses the hot key thereafter, from any part of the system, the window specified in the WM_SETHOTKEY message receives a WM_SYSCOMMAND message specifying SC_HOTKEY. This message activates the window that receives it. The hot key remains valid until the application that called WM_SETHOTKEY exits.

This mechanism is different from the hot key support that depends on the WM_HOTKEY message and the Windows RegisterHotKey and UnregisterHotKey functions.

For more information on using CHotKeyCtrl, see Controls and Using CHotKeyCtrl.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CHotKeyCtrl

Requirements

Header: afxcmn.h

See Also

Reference

CWnd Class

Hierarchy Chart