Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
CWnd::OnSysKeyDown
◄CWnd► ◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
afx_msg void OnSysKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
Parameter Description
<nChar> Specifies the virtual-key code of the key being pressed.
<nRepCnt> Specifies the repeat count.
<nFlags> Specifies the scan code, key-transition code, previous key
state, and context code, as shown in the following list:
Value Description
0-7 Scan code (OEM-dependent value). Low byte of
high-order word.
8 Extended key, such as a function key or a key on the
numeric keypad (1 if it is an extended key;
otherwise 0).
9-10 Not used.
11-12 Used internally by Windows.
13 Context code (1 if the ALT key is held down while
the key is pressed, 0 otherwise).
14 Previous key state (1 if the key is down before the
message is sent, 0 if the key is up).
15 Transition state (1 if the key is being released, 0
if the key is being pressed).
For OnSysKeyDown calls, the key-transition bit (bit 15) is
0. The context-code bit (bit 13) is 1 if the ALT key is down
while the key is pressed; it is 0 if the message is sent to
the active window because no window has the input focus.
Remarks
If the CWnd has the input focus, the OnSysKeyDown member function is
called when the user holds down the ALT key and then presses another
key. If no window currently has the input focus, the active window's
OnSysKeyDown member function is called. The CWnd that receives the
message can distinguish between these two contexts by checking the
context code in <nFlags>.
When the context code is 0, the WM_SYSKEYDOWN message received by
OnSysKeyDown can be passed to the ◄TranslateAccelerator► Windows
function, which will handle it as though it were a normal key message
instead of a system-key message. This allows accelerator keys to be used
with the active window even if the active window does not have the input
focus.
Because of auto-repeat, more than one OnSysKeyDown call may occur before
the ◄WM_SYSKEYUP► message is received. The previous key state (bit 14)
can be used to determine whether the OnSysKeyDown call indicates the
first down transition or a repeated down transition.
For IBM Enhanced 101- and 102-key keyboards, enhanced keys are the right
ALT and the right CONTROL keys on the main section of the keyboard; the
INSERT, DELETE, HOME, END, PAGE UP, PAGE DOWN, and ARROW keys in the
clusters to the left of the numeric keypad; and the slash (/) and ENTER
keys in the numeric keypad. Some other keyboards may support the
extended-key bit in <nFlags>.
This message-handler member function calls the ◄Default► member
function. Override this member function in your derived class to handle
the ◄WM_SYSKEYDOWN► message.
See Also
◄::TranslateAccelerator►, ◄WM_SYSKEYUP►, ◄CWnd::Default►,
◄WM_SYSKEYDOWN►
-♦-