Export (0) Print
Expand All
MFC
Expand Minimize

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  
);

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.

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

// 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
}

Header: afxwin.h

Community Additions

ADD
Show:
© 2014 Microsoft