Condividi tramite


CWnd::OnHotKey

The framework calls this member function when the user presses a system-wide hot key.

afx_msg void OnHotKey(
    UINT nHotKeyId, 
    UINT nKey1, 
    UINT nKey2
);

Parameters

Parameter

Description

[in] nHotKeyId

Identifier for the hot key that generated the message. If the message was generated by a system-defined hot key, this parameter will be one of the following values:

  • IDHOT_SNAPDESKTOP - The snap desktop hot key was pressed.

  • IDHOT_SNAPWINDOW - The snap window hot key was pressed.

[in] nKey1

A bitwise combination (OR) of flags that indicate the keys that were pressed in combination with the key specified by the nKey2 parameter. The possible values are:

  • MOD_ALT - Either ALT key was held down.

  • MOD_CONTROL - Either CTRL key was held down.

  • MOD_SHIFT - Either SHIFT key was held down.

  • MOD_WIN - Either WINDOWS key was held down. These keys are labeled with the Microsoft Windows logo.

[in] nKey2

The virtual key code of the hot key.

Remarks

This method receives the WM_HOTKEY notification, which is described in the Windows SDK. This message is placed at the top of the message queue associated with the thread that registered the hot key. Use the RegisterHotKey function to register a system-wide hot key.

Note

This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.

Requirements

Header: afxwin.h

This method is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

See Also

Reference

CWnd Class

Hierarchy Chart

WM_HOTKEY