This documentation is archived and is not being maintained.

CWnd::CheckDlgButton

Selects (places a check mark next to) or clears (removes a check mark from) a button, or it changes the state of a three-state button.

void CheckDlgButton(
   int nIDButton,
   UINT nCheck 
);

Parameters

nIDButton
Specifies the button to be modified.
nCheck
Specifies the action to take. If nCheck is nonzero, the CheckDlgButton member function places a check mark next to the button; if 0, the check mark is removed. For three-state buttons, if nCheck is 2, the button state is indeterminate.

Remarks

The CheckDlgButton function sends a BM_SETCHECK message to the specified button.

Example

// Sets 3 check buttons in various ways.  Note BST_INDETERMINATE
// requires BS_3STATE or BS_AUTO3STATE in the button's style.
void CMyDlg::OnMarkButtons() 
{
   CheckDlgButton(IDC_CHECK1, BST_UNCHECKED);   // 0
   CheckDlgButton(IDC_CHECK2, BST_CHECKED);   // 1
   CheckDlgButton(IDC_CHECK3, BST_INDETERMINATE);   // 2
}

See Also

CWnd Overview | Class Members | Hierarchy Chart | CWnd::IsDlgButtonChecked | CButton::SetCheck | CheckDlgButton

Show: