我不想将它和一个变量联系起来。
就像GetDlgItem(IDC_CODE)->SetWindowText(m_strCode);一样。
比如这个checkbox的id是IDC_CHK1

解决方案 »

  1.   

    GetDlgItem(IDC_CODE)->EnableWindow(false)
      

  2.   

    GetDlgItem(IDC_CODE)->EnableWindow(false)
      

  3.   

    使用它的成员函数SetCheck()
    参见MSDN
    CButton::SetCheck 
    void SetCheck( int nCheck );Parameters
        nCheck
    Specifies the check state. This parameter can be one of the following:Value Meaning 
    0 Set the button state to unchecked. 
    1 Set the button state to checked. 
    2 Set the button state to indeterminate. This value can be used only if the button has the BS_3STATE or BS_AUTO3STATE style. 
      

  4.   

    在下用GetDlgItem(IDC_CHK_Data)->SetCheck(0,1);,结果出现错误:
    D:\HKTrans\ConfigDlg.cpp(106) : error C2039: 'SetCheck' : is not a member of 'CWnd'
      

  5.   

    ((CButton*) GetDlgItem(IDC_CHK1)->SetCheck(TRUE);
    ((CButton*) GetDlgItem(IDC_CHK1)->SetCheck(FALSE);