Static Control Default Message Processing

The window procedure for the predefined static control window class performs default processing for all messages that the static control procedure does not process. When the static control returns FALSE for any message, the predefined window procedure checks the messages and carries out the default action described in the following table. In the table, a text static control is a static control with the style SS_LEFTNOWORDWRAP, SS_LEFT, SS_CENTER, SS_RIGHT, or SS_SIMPLE.

Message Default action
WM_CREATE Loads the graphic object and sizes the window to the object's size, for graphic static controls. Takes no action for other static controls.
WM_DESTROY Frees and destroys any graphic object, for graphic static controls. Takes no action for other static controls.
WM_ENABLE Repaints visible static controls.
WM_ERASEBKGND Returns TRUE, indicating the control erases the background.
WM_GETDLGCODE Returns DLGC_STATIC.
WM_GETFONT Returns a handle to the font for text static controls.
WM_GETTEXTLENGTH Returns the length, in characters, of the text for a text static control.
WM_LBUTTONDBLCLK Sends the parent window an STN_DBLCLK notification message if the control style is SS_NOTIFY.
WM_LBUTTONDOWN Sends the parent window an STN_CLICKED notification message if the control style is SS_NOTIFY.
WM_NCLBUTTONDBLCLK Sends the parent window an STN_DBLCLK notification message if the control style is SS_NOTIFY.
WM_NCLBUTTONDOWN Sends the parent window an STN_CLICKED notification message if the control style is SS_NOTIFY.
WM_NCHITTEST Returns HTCLIENT if the control style is SS_NOTIFY; otherwise, returns HTTRANSPARENT.
WM_PAINT Repaints the control.
WM_SETFONT Sets the font and repaints for text static controls.
WM_SETTEXT Sets the text and repaints for text static controls.

The predefined window procedure passes all other messages to DefWindowProc for default processing.