Skip to content

Latest commit

 

History

History
124 lines (97 loc) · 4.33 KB

File metadata and controls

124 lines (97 loc) · 4.33 KB
title CMFCAcceleratorKey Class | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-windows
ms.tgt_pltfrm
ms.topic reference
f1_keywords
CMFCAcceleratorKey
AFXACCELERATORKEY/CMFCAcceleratorKey
AFXACCELERATORKEY/CMFCAcceleratorKey::CMFCAcceleratorKey
AFXACCELERATORKEY/CMFCAcceleratorKey::Format
AFXACCELERATORKEY/CMFCAcceleratorKey::SetAccelerator
dev_langs
C++
helpviewer_keywords
CMFCAcceleratorKey class
ms.assetid d140fbf7-23db-45ea-a63e-414a5ec7b3d5
caps.latest.revision 36
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

CMFCAcceleratorKey Class

A helper class that implements virtual key mapping and formatting.

Syntax

class CMFCAcceleratorKey : public CObject  

Members

Public Constructors

Name Description
CMFCAcceleratorKey::CMFCAcceleratorKey Constructs a CMFCAcceleratorKey object.

Public Methods

Name Description
CMFCAcceleratorKey::Format Translates the ACCEL structure to its visual representation.
CMFCAcceleratorKey::SetAccelerator Sets the shortcut key for the CMFCAcceleratorKey object.

Remarks

Accelerator keys are also known as shortcut keys. If you want to display keyboard shortcuts that a user enters, the CMFCAcceleratorKeyAssignCtrl Class maps keyboard shortcuts, such as Alt+Shift+S, to a custom text format, such as "Alt + Shift + S". Each CMFCAcceleratorKey object maps a single shortcut key to a text format.

For more information about how to use shortcut keys and accelerator tables, see CKeyboardManager Class.

Example

The following example demonstrates how to construct a CMFCAcceleratorKey object and how to use its Format method.

[!code-cppNVC_MFC_RibbonApp#30]

Inheritance Hierarchy

CObject

CMFCAcceleratorKey

Requirements

Header: afxacceleratorkey.h

CMFCAcceleratorKey::CMFCAcceleratorKey

Constructs a CMFCAcceleratorKey object.

CMFCAcceleratorKey();  
CMFCAcceleratorKey(LPACCEL lpAccel);

Parameters

[in] lpAccel
A pointer to a shortcut key.

Remarks

If you do not provide a shortcut key when you create a CMFCAccleratorKey, use the CMFCAcceleratorKey::SetAccelerator method to associate a shortcut key with your CMFCAcceleratorKey object.

CMFCAcceleratorKey::Format

Translates the ACCEL structure to its associated string value.

void Format(CString& str) const;  

Parameters

[out] str
A reference to a CString object where the method writes the translated shortcut key.

Remarks

This method retrieves the string format of the associated shortcut key. You can set the string format of a CMFCAcceleratorKey object using either the constructor or the method CMFCAcceleratorKey::SetAccelerator.

CMFCAcceleratorKey::SetAccelerator

Sets the shortcut key for the CMFCAcceleratorKey object.

void SetAccelerator(LPACCEL lpAccel);

Parameters

[in] lpAccel
A pointer to a shortcut key.

Remarks

Use this method to set the shortcut key for a CMFCAcceleratorKey if you did not provide a shortcut key when you created the CMFCAcceleratorKey.

See Also

Hierarchy Chart
Classes
CKeyboardManager Class