WM_CTLCOLOREDIT

This message notifies the parent window of an edit 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 edit control.

WM_CTLCOLOREDIT 
  hdcEdit = (HDC) wParam; 
  hwndEdit = (HWND) lParam; 

Parameters

  • hdcEdit
    Handle to the device context for the edit control window.
  • hwndEdit
    Handle to the edit control.

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 edit control. If the application does not process this message, the DefWindowProc function selects the default system colors for the edit control.

Remarks

Read-only or disabled edit controls do not send the WM_CTLCOLOREDIT message; instead, they send the WM_CTLCOLORSTATIC message.

The system does not automatically destroy the returned brush. The application is responsible for destroying the brush when it is no longer needed.

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, the dialog box procedure 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.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Windows.h.

See Also

DefWindowProc | RealizePalette | SelectPalette | WM_CTLCOLORBTN | WM_CTLCOLORDLG | WM_CTLCOLORLISTBOX | WM_CTLCOLORSCROLLBAR | WM_CTLCOLORSTATIC | Edit Box Messages

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.