CMFCAcceleratorKeyAssignCtrl Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCAcceleratorKeyAssignCtrl Class.

The CMFCAcceleratorKeyAssignCtrl class extends the CEdit Class to support extra system buttons such as ALT, CONTROL, and SHIFT.

class CMFCAcceleratorKeyAssignCtrl : public CEdit  

Public Constructors

NameDescription
CMFCAcceleratorKeyAssignCtrl::CMFCAcceleratorKeyAssignCtrlConstructs a CMFCAcceleratorKeyAssignCtrl object.

Public Methods

NameDescription
CMFCAcceleratorKeyAssignCtrl::GetAccelRetrieves the ACCEL structure for a shortcut key pressed in the CMFCAcceleratorKeyAssignCtrl object.
CMFCAcceleratorKeyAssignCtrl::IsFocused
CMFCAcceleratorKeyAssignCtrl::IsKeyDefinedDetermines whether a shortcut key has been defined.
CMFCAcceleratorKeyAssignCtrl::PreTranslateMessageUsed by class CWinApp to translate window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions. (Overrides CWnd::PreTranslateMessage.)
CMFCAcceleratorKeyAssignCtrl::ResetKeyResets the shortcut key.

This class extends the functionality of the CEdit class by supporting shortcut keys, also known as accelerator keys. The CMFCAcceleratorKeyAssignCtrl class functions as a CEdit Class and it can also recognize system buttons.

This class maps physical shortcut key combinations to string values. For example, assume the key combination ALT + B is mapped to the string "Alt + B". When the user presses this key combination in a CMFCAcceleratorKeyAssignCtrl object, "Alt + B" is displayed to the user. For more information about the mapping between shortcut keys and a string format, see CMFCAcceleratorKey Class.

The following example demonstrates how to construct a CMFCAcceleratorKeyAssignCtrl object and use its ResetKey method to reset the shortcut key.

	CMFCAcceleratorKeyAssignCtrl* accelCtrl = new CMFCAcceleratorKeyAssignCtrl();
	accelCtrl->ResetKey();

CObject

CCmdTarget

CWnd

CEdit

CMFCAcceleratorKeyAssignCtrl

Header: afxacceleratorkeyassignctrl.h

Constructs a CMFCAcceleratorKeyAssignCtrl object.

CMFCAcceleratorKeyAssignCtrl();

Retrieves the ACCEL structure for a shortcut key pressed in the CMFCAcceleratorKeyAssignCtrl object.

ACCEL const* GetAccel() const;  

Return Value

An ACCEL structure that describes the shortcut key.

Remarks

Use this function to retrieve the ACCEL structure for a shortcut key that the user entered into your CMFCAcceleratorKeyAssignCtrl object.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

BOOL IsFocused() const;  

Return Value

Remarks

Determines whether a shortcut key has been defined in the CMFCAcceleratorKeyAssignCtrl object.

BOOL IsKeyDefined() const;  

Return Value

Nonzero if the user has already pressed a valid combination of keys that define a shortcut key; otherwise 0.

Remarks

Use this function to determine whether the user entered a valid shortcut key in your CMFCAcceleratorKeyAssignCtrl object. If a shortcut key exists, you can use CMFCAcceleratorKeyAssignCtrl::GetAccel method to obtain the ACCEL structure associated with this shortcut key.

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

virtual BOOL PreTranslateMessage(MSG* pMsg);

Parameters

[in] pMsg

Return Value

Remarks

Resets the shortcut key.

void ResetKey();

Remarks

The function clears the edit control text. This includes any shortcut keys that the user pressed.

Hierarchy Chart
Classes
CMFCAcceleratorKey Class

Show: