// If the item is not the correct answer, tell the // user to try again. // // If the item is the correct answer, congratulate // the user and destroy the dialog box.
msdn 是这样说的: -------------------------------------------------- Microsoft Windows CE 3.0 WM_CTLCOLOREDIT
This message is sent to 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. Default Action 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. However, for compatibility purposes, the system sends the WM_CTLCOLOREDIT message for read-only and disabled edit controls if the application was designed for Windows 3.1 or earlier.
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_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 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. -------------------------------------------------- 上面这个还是 ce 的说明. 下面这个是标准 windows api 的. -------------------------------------------------- WM_CTLCOLOREDIT Notification Language Filter : All WM_CTLCOLOREDIT Notification
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.
Syntax WM_CTLCOLOREDIT
WPARAM wParam LPARAM lParam;
Parameters wParam A handle to the device context for the edit control window. lParam A handle to the edit control.
Return Value 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.
Remarks
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 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.
Rich Edit: This message is not supported. To set the background color for a rich edit control, use the EM_SETBKGNDCOLOR message.
Notification RequirementsMinimum DLL Version None Header Declared in Winuser.h, include Windows.h Minimum operating systems Windows 95, Windows NT 3.1
See Also Edit Controls Overview, DefWindowProc, EM_SETBKGNDCOLOR, RealizePalette, SelectPalette, WM_CTLCOLORSTATIC