The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control.
A window receives this message through its WindowProc function.
Handle to the device context for the scroll bar control.
Handle to the scroll bar.
If an application processes this message, it must return the handle to a brush. The system uses the brush to paint the background of the scroll bar 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 scroll bar control.
The WM_CTLCOLORSCROLLBAR 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.
The WM_CTLCOLORSCROLLBAR message is used only by child scroll bar controls. Scrollbars attached to a window (WS_SCROLL and WS_VSCROLL) do not generate this message. To customize the appearance of scrollbars attached to a window, use the flat scroll bar functions.
Minimum supported client
|Windows 2000 Professional [desktop apps only]|
Minimum supported server
|Windows 2000 Server [desktop apps only]|
- Other Resources