共用方式為


CHotKeyCtrl::GetHotKey

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

DWORD GetHotKey() const;
void GetHotKey(
   WORD &wVirtualKeyCode,
   WORD &wModifiers
) const;

Parameters

  • [out] wVirtualKeyCode
    Virtual key code of the keyboard shortcut. For a list of standard virtual key codes, see Winuser.h.

  • [out] wModifiers
    A bitwise combination (OR) of flags that indicate the modifier keys in the keyboard shortcut.

    The modifier flags are as follows:

    Flag

    Corresponding Key

    HOTKEYF_ALT

    ALT key

    HOTKEYF_CONTROL

    CTRL key

    HOTKEYF_EXT

    Extended key

    HOTKEYF_SHIFT

    SHIFT key

Return Value

In the first overloaded method, a DWORD that contains the virtual key code and modifier flags. The low-order byte of the low-order word contains the virtual key code, the high-order byte of the low-order word contains the modifier flags, and the high-order word is zero.

Remarks

The virtual key code and the modifier keys together define the keyboard shortcut.

Requirements

Header: afxcmn.h

See Also

Reference

CHotKeyCtrl Class

Hierarchy Chart

CHotKeyCtrl::SetHotKey

Other Resources

CHotKeyCtrl Members