CHotKeyCtrl::GetKeyName

Call this member function to get the localized name of the key assigned to a specified virtual key code.

static CString GetKeyName(
   UINT vk,
   BOOL fExtended 
);

Parameters

  • vk
    The virtual key code.

  • fExtended
    If the virtual key code is an extended key, TRUE; otherwise FALSE.

Return Value

The localized name of the key specified by the vk parameter. If the key has no mapped name, GetKeyName returns an empty string.

Remarks

The key name that this function returns comes from the keyboard driver, so you can install a non-localized keyboard driver in a localized version of Windows, and vice versa.

Example

CString str;

str = CHotKeyCtrl::GetKeyName(VK_CONTROL, FALSE);

// str is now "Ctrl", or the localized equivalent.

Requirements

Header: afxcmn.h

See Also

Reference

CHotKeyCtrl Class

Hierarchy Chart

WM_KEYDOWN

GetKeyNameText

CHotKeyCtrl::GetHotKeyName

Other Resources

CHotKeyCtrl Members