WM_CTLCOLOREDIT message
An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window 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 edit control.
WM_CTLCOLOREDIT
WPARAM wParam;
LPARAM lParam;
-
wParam
-
A handle to the device context for the edit control window.
-
lParam
-
A handle to the edit control.
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 edit control.
If the application returns a brush that it created (for example, by using the CreateSolidBrush or CreateBrushIndirect function), the application must free the brush. If the application returns a system brush (for example, one that was retrieved by the GetStockObject or GetSysColorBrush function), the application does not need to free the brush.
By default, the DefWindowProc function selects the default system colors for the edit control.
Read-only or disabled edit controls do not send the WM_CTLCOLOREDIT message; instead, they send the WM_CTLCOLORSTATIC message.
The WM_CTLCOLOREDIT message is never sent between threads, it is only sent within the same thread.
If a dialog box procedure handles this message, it should cast the desired return value to a 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.
Rich Edit: This message is not supported. To set the background color for a rich edit control, use the EM_SETBKGNDCOLOR message.
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista [desktop apps only] |
Minimum supported server |
Windows Server 2003 [desktop apps only] |
Header |
|
-
Reference
-
Other Resources