Controls

 

Buttons

All buttons are actually child windows.

 

Button Types

Value

Description

BS_PUSHBUTTON

Regular button. Posts a WM_COMMAND msg

BS_RADIOBUTTON

Circle w/text to right

BS_AUTORADIOBUTTON

Same a radio button except, click event checks it and unchecks all others

BS_CHECKBOX

square w/text to right (2 states checked or unchecked)

BS_AUTOCHECKBOX

Same a checkbox except, click event toggles between checked & unchecked

BS_3STATE

Same checkbox w/1 mare state (grayed)

BS_AUTO3STATE

Same a 3 state except, click event cycles between checked, grayed & unchecked

BS_OWNERDRAW

Sends a WM_MEASUREITEM msg when button is created &WM_DRAWITEM msg when button changes appearance 

 

To create one:

·       In the CreateWindowEx() function

o      Set class to “button” , the style to WS_CHILD | WS_VISIBLE | <button type> and the menu handle to a button ID – you will need to cast this

·       Button events send WM_COMMAND msg

o      LOWORD(wparam) = child window ID

o      HIWORD(wparam) = notification code

o       lparm = child window handle

 

Codes: BN_CLICKED/PAINT/HLITE/UNHLITE/DISABLE/DOUBLECLICKED