An application can customize the appearance of a button by using the BS_USERBUTTON style in combination with other button styles. The owner window receives WM_CONTROL messages for these custom buttons whenever they must be drawn, highlighted, or disabled.
When a button must be drawn, the owner window receives a WM_CONTROL message with the high word of the first parameter equal to BN_PAINT. The second parameter is a pointer to a USERBUTTON structure that contains information the application needs to draw the button.
An application uses the hwnd member of the USERBUTTON structure in a call to the WinQueryWindowRect function to find the bounding rectangle for the button. The hps member is used as a presentation space for any drawing. The fsState member contains flags that tell an application how to draw the button: highlighted, unhighlighted, or disabled. The fsStateOld member contains flags that describe the current highlighted, unhighlighted, or disabled state of the button.