Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This message is sent to the parent window of a static control when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control.

Syntax

WM_CTLCOLORSTATIC 
hdcStatic = (HDC) 
wParam; 

hwndStatic = (HWND) 
lParam;

Parameters

hdcStatic

Handle to the device context for the static control window.

hwndStatic

Handle to the static control.

Return Value

If an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control.

Default Action

The DefWindowProcfunction selects the default system colors for the static control.

Remarks

The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.

The WM_CTLCOLORSTATIC message is never sent between threads. It is sent only within the same thread.

If a dialog box procedure handles this message, it should cast the desired return value to a BOOLand return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLongfunction is ignored.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also