1、改变一个checkbox的checked状态:
BOOL CheckDlgButton( HWND hDlg, // 所在窗口的句柄 int nIDButton, // 要改变的checkbox UINT uCheck // 要改成的状态 );
其中uCheck这个可以取以下值:
// 选中状态
BST_CHECKED Sets the button state to checked.
// 变灰
BST_INDETERMINATE Sets the button state to grayed, indicating an indeterminate state.Use this value only if the button has the BS_3STATE or BS_AUTO3STATE style.
// 非选中状态
BST_UNCHECKED Sets the button state to cleared
2、要获取一个check box的状态:
UINT IsDlgButtonChecked( HWND hDlg,//控件所在的窗口句柄 int nIDButton//check box的ID );
返回值为以下:
BST_CHECKED Button is checked.//表示选中状态
BST_INDETERMINATE Button is grayed, indicating an indeterminate state (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
BST_UNCHECKED Button is cleared//表示未选中状态