WM_CTLCOLORMSGBOX

This message is sent to the owner window of a message box before Windows draws the message box. By responding to this message, the owner window can set the text and background colors of the message box by using the specified display device context handle.

At a Glance

Header file: Winuser.h
Windows CE versions: 2.0 and later

Syntax

WM_CTLCOLORMSGBOX hdcMB = (HDC) wParam; hwndMB = (HWND) lParam;

Parameters

hdcMB

Handle to the device context for the message box

hwndMB

Handle to the message box

Return Values

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

Default Action

The DefWindowProc function selects the default system colors for the message box.

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

If a dialog box procedure handles this message, it should cast the desired return value to a BOOL 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.

See Also

DefWindowProc, RealizePalette, SelectPalette, WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC