home Tech Library Tech Forum
Publisher
 
Creating an MFC Application       
 
 
Windows OS Message handlers in CWnd
 
 

 

The Regular Windows OS Messages are categorized into a a number of sub categories like Input Messages, General Messages, System Messages , non-client area messages and clipboard messages. Some examples of these messages are listed here below.

Input Messages
 
WM_CHAR void OnChar(UINT, UINT, UINT);
invoked while a keystroke translates to a non-system character.

WM_HSCROLL void OnHScroll(UINT, UINT,UINT);
invoked when the user clicks the horizontal scroll bar of CWnd window.
 
WM_KEYDOWN void OnKeyDown(UINT,UINT,UINT);
invoked when a non-system key is pressed.

WM_KEYUP void OnKeyUp(UINT,UINT,UINT);
invoked when a non-system key is released.

WM_LBUTTONDBLCLK void OnLButtonDblClk(UINT, Cpoint);
invoked when the user double-clicks the left mouse button.
 
WM_LBUTTONDOWN void OnLButtonDown(UINT,CPoint);
invoked when the user presses the left mouse button.
 
WM_LBUTTONUP void OnLButtonUp(UINT, Cpoint);
invoked when the user releases the left mouse button.
 
WM_MOUSEMOVE void OnMouseMove(UINT,CPoint);
invoked when the mouse cursor moves.
 
WM_RBUTTONDBLCLK void OnRButtonDblClk(UINT, Cpoint);
invoked when the user double-clicks the right mouse button.
 
WM_RBUTTONDOWN void OnRButtonDown(UINT,CPoint);
invoked when the user presses the right mouse button.

WM_RBUTTONUP void OnRButtonUp(UINT,CPoint);
invoked when the user releases the right mouse button.

WM_SETCURSOR BOOL OnSetCursor( CWnd*, UINT, UINT);
invoked only if mouse input is not captured and the mouse causes cursor movement within a window.

WM_TIMER void OnTimer(UINT);
invoked at specified interval in SetTimer.

WM_VSCROLL void OnVScroll(UINT,UINT,CWnd*);
invoked when the user clicks the window’s vertical scroll bar.


General Messages

 
WM_ACTIVATE void OnActivate(UINT, CWnd*, BOOL);
invoked when CWnd object or the window is being activated or deactivated.

WM_ACTIVATEAPP void OnActivateApp(BOOL, HANDLE);
invoked when the application is about to be activated.
 
WM_CANCELMODE void OnCancelMode();
invoked to allow CWnd to cancel any internal modes, such as mouse capture.
 
WM_CLOSE void OnClose();
invoked to close the window or CWnd.
 
WM_CREATE int OnCreate(LPCREATESTRUCT);
invoked as a part of window creation.
 
WM_DESTROY void OnDestroy();
invoked when CWnd is being destroyed.

WM_ENDSESSION void OnEndSession(BOOL);
invoked when the session is enabled or disabled.
 
WM_ENTERIDLE void OnEnterIdle(UINT, CWnd* );
invoked to inform an application’s main window procedure that a modal dialog box or a menu is entering an idle state.
 
WM_ERASEBKGND BOOL OnEraseBkgnd(CDC*);
invoked when the window background needs erasing.
 
WM_GETMINMAXINFO void OnGetMinMaxInfo(LPPOINT);
invoked whenever Windows OS needs to know the maximized position or dimensions, or the minimum or maximum tracking size.
 
WM_ICONERASEBKGND void OnIconEraseBkgnd(CDC*);
invoked when CWnd is minimized and the background of the icon must be filled before painting the icon.

WM_KILLFOCUS void OnKillFocus(CWnd* );
invoked immediately before CWnd loses the input focus.

WM_MOVE void OnMove(int, int);
invoked after the position of the CWnd or window has been changed.
 
WM_PAINT void OnPaint();
invoked to repaint a portion of the window.
 
WM_QUERYENDSESSION BOOL OnQueryEndSession();
invoked when the user chooses to end the Windows OS session.
 
WM_QUERYNEWPALETTE BOOL OnQueryNewPalette();
informs CWnd that it is about to receive input focus, so it can realize its palette.

WM_SETFOCUS void OnSetFocus(CWnd* );
invoked after CWnd gains the input focus.

WM_SHOWWINDOW void OnShowWindow(BOOL, UINT);
invoked when CWnd is to be hidden or shown.

WM_SIZE void OnSize(UINT, int, int);
invoked after the size of CWnd or window has changed.

 

   
  RELATED TOPICS  
Structure of an MFC Application
Creating a Main Window Using MFC
Window Styles
Registering a Window Class
Resource Files in MFC Applications
Menus in MFC Application
Message Maps in MFC Application
Accelerators in MFC Applications
Message Handler Functions
Timer in an MFC Application
Message Box in MFC
Dynamic Menu in MFC
 


 
           
Home | Profile | Users | Library | Publisher | Tech Forum | News | Contact Us