The first two buttons shown in BTNLOOK are ”push“ buttons. A push button is a rectangle enclosing text specified in the window text parameter of the CreateWindow call. The rectangle takes up the full height and width of the dimensions given in the CreateWindow or MoveWindow call. The text is centered within the rectangle.
Push-button controls are used mostly to trigger an immediate action without retaining any type of on/off indication. The two types of push-button controls have window styles called BS_PUSHBUTTON and BS_DEFPUSHBUTTON. The ”DEF“ in BS_DEFPUSHBUTTON stands for ”default.“ When used to design dialog boxes, BS_PUSHBUTTON controls and BS_DEFPUSHBUTTON controls function differently from one another. When used as child window controls, however, the two types of push buttons function the same way, although BS_DEFPUSHBUTTON has a heavier outline.
A push button looks best when its height is 7/4 times the height of a SYSTEM_FONT character, which is what BTNLOOK uses. The push button's width must accommodate at least the width of the text plus two additional characters.
When the mouse cursor is inside the push button, pressing the mouse button causes the button to repaint itself using 3D-style shading to appear as if it's been depressed. Releasing the mouse button restores the original appearance and sends a WM_COMMAND message to the parent window with notification code BN_CLICKED. As with the other button types, when a push button has the input focus, a dashed line surrounds the text, and pressing and releasing the Spacebar has the same effect as pressing and releasing the mouse button.
You can simulate a push-button flash by sending the window a BM_SETSTATE message. This causes the button to be depressed:
SendMessage (hwndButton, BM_SETSTATE, 1, 0L) ;
This call causes the button to return to normal:
SendMessage (hwndButton, BM_SETSTATE, 0, 0L) ;
The hwndButton window handle is the value returned from the CreateWindow call.
You can also send a BM_GETSTATE message to a push button. The child window control returns the current state of the button—TRUE if the button is depressed and FALSE (or 0) if normal. Most applications do not require this information, however. And because push buttons do not retain any on/off information, the BM_SETCHECK and BM_GETCHECK messages are not used.
Buttons created with the BS_PUSHBOX style are displayed only when the button has the input focus. This style of button is rarely used by Windows applications.