virtual void OnKeyUp ( UINT nChar, UINT nRepCnt, UINT nFlags );


nChar Specifies the virtual-key code of the given key.
nRepCnt  Repeat count (the number of times the keystroke is repeated as a result of the user holding down the key).

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).
8 Extended key, such as a function key or a key on the numeric keypad (1 if it is an extended key).
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; otherwise 0).
14 Previous key state (1 if the key is down before the call, 0 if the key is up).
15 Transition state (1 if the key is being released, 0 if the key is being pressed).

For a WM_KEYDOWN message, the key-transition bit (bit 15) is 0 and the context-code bit (bit 13) is 0.


The application should pass WM_KEYDOWN events information from the object window to the COpenGL object by using the OnKeyDown method function. This allows appropriate COpenGL object actions according to the currently set COpenGL object’s interaction mode.


class COglSampleView : public CView
  // specify operations or attributes as desired …
  COpenGL  m_OpenGL;
  // specify operations or attributes as desired …

void COglSampleView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
  // COpenGL object key up event processing
  m_OpenGL.OnKeyUp( nChar, nRepCnt, nFlags );
  // default CView key up processing
  CView::OnKeyUp(nChar, nRepCnt, nFlags);

See Also

OnKeyDown, OnLButtonDown, OnLButtonUp, OnMouseMove