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 given display context handle to set the background color of the scroll bar control.
WM_CTLCOLORSCROLLBAR
hdcSB = (HDC) wParam; // handle to scroll-bar display context
hwndSB = (HWND) lParam; // handle to 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.
The DefWindowProc function selects the default system colors for the scroll bar control.
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_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 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.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 2.0 or later.
Header: Declared in winuser.h.
Scroll Bars Overview, Scroll Bar Messages, DefWindowProc, RealizePalette, SelectPalette, WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORMSGBOX, WM_CTLCOLORSTATIC