WM_CTLCOLORDLG message

Sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle.

#define WM_CTLCOLORDLG                  0x0136

Parameters

wParam

A handle to the device context for the dialog box.

lParam

A handle to the dialog box.

Return value

If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the dialog box.

Remarks

By default, the DefWindowProc function selects the default system colors for the dialog box.

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_CTLCOLORDLG message is never sent between threads. It is sent only within one thread.

Note that the WM_CTLCOLORDLG message is sent to the dialog box itself; all of the other WM_CTLCOLOR* messages are sent to the owner of the control.

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

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

Reference

DefWindowProc

SetWindowLong

Conceptual

Dialog Boxes

Other Resources

RealizePalette

SelectPalette