Default Tab Control Message Processing

This section describes the message processing performed by a tab control. Messages specific to tab controls are discussed elsewhere and are, therefore, not included here.

Message Processing performed
WM_CAPTURECHANGED Does nothing if the tab control released the mouse capture itself. If another window captured the mouse and a button is held down, the command releases the button.
WM_CREATE Allocates and initializes an internal data structure. The control creates a tool tip control if the TCS_TOOLTIPS style is specified.
WM_DESTROY Frees resources allocated during WM_CREATE processing.
WM_GETDLGCODE Returns a combination of the DLGC_WANTARROWS and DLGC_WANTCHARS values.
WM_GETFONT Returns the handle of the font used for labels.
WM_KEYDOWN Processes DIRECTION keys and changes the selection, if appropriate.
WM_KILLFOCUS Invalidates the tab that has the focus, so it will be repainted to reflect an unfocused state.
WM_LBUTTONDOWN Forwards the message to the tool tip control, if any, and changes the selection if the user is clicking a tab. If the user is clicking a button, the control redraws the button to give a sunken appearance and captures the mouse.

If the user is clicking either a tab or button and the TCS_FOCUSONBUTTONDOWN style is specified, the control sets the focus to itself.

WM_LBUTTONUP Releases the mouse if a button was pressed. If the cursor is over the button and is being held down, the control changes the selection accordingly and redraws the button.
WM_MOUSEMOVE Forwards the message to the tool tip control, if any. If the TCS_BUTTONS style is specified and the mouse button is being held down after clicking, the control may also redraw the affected button to give it a raised or sunken appearance.
WM_NOTIFY Forwards notification messages sent by the tool tip control.
WM_PAINT Draws a border around the display area (unless the TCS_BUTTONS style is specified) and paints any tabs that intersect the invalid rectangle.

For each tab, it draws the body of each tab (or sends a WM_DRAWITEM message to the parent window) and then draws a border around the tab. If the wParam parameter is non-NULL, the control assumes that the value is an HDC and paints using that device context.

WM_RBUTTONDOWN Sends an NM_RCLICK notification message to the parent window.
WM_SETFOCUS Invalidates the tab that has the focus so that it will be repainted to reflect a focused state.
WM_SETFONT Sets the font used for labels.
WM_SETREDRAW Sets the state of an internal flag that determines whether the control is repainted when items are inserted and deleted, when the font is changed, and so on.
WM_SIZE Recalculates the positions of tabs and may invalidate part of the tab control to force repainting of some or all tabs.