This documentation is archived and is not being maintained.


The framework calls this member function when the OnKeyUp member function and the OnKeyDown member functions are called.

afx_msg void OnDeadChar( 
   UINT nChar, 
   UINT nRepCnt, 
   UINT nFlags  


Specifies the dead-key character value.


Specifies the repeat count.


Specifies the scan code, key-transition code, previous key state, and context code, as shown in the following list:




Scan code (OEM-dependent value). Low byte of high-order word.


Extended key, such as a function key or a key on the numeric keypad (1 if it is an extended key; otherwise 0).


Not used.


Used internally by Windows.


Context code (1 if the ALT key is held down while the key is pressed; otherwise 0).


Previous key state (1 if the key is down before the call, 0 if the key is up).


Transition state (1 if the key is being released, 0 if the key is being pressed).

This member function can be used to specify the character value of a dead key. A dead key is a key, such as the umlaut (double-dot) character, that is combined with other characters to form a composite character. For example, the umlaut-O character consists of the dead key, umlaut, and the O key.

An application typically uses OnDeadChar to give the user feedback about each key pressed. For example, an application can display the accent in the current character position without moving the caret.

Since there is not necessarily a one-to-one correspondence between keys pressed and OnDeadChar calls, the information in nFlags is generally not useful to applications. The information in nFlags applies only to the most recent call to the OnKeyUp member function or the OnKeyDown member function that precedes the OnDeadChar call.

For IBM Enhanced 101- and 102-key keyboards, enhanced keys are the right ALT and the right CTRL keys on the main section of the keyboard; the INS, DEL, 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.

Note 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.

Header: afxwin.h