我使用.net 2003,做了一个复合控件,在控件上有一个radio按钮和一个checkbox选项。
我想给他们赋初值,就是缺省被选中的样子,如何作呢。刚看到有说//CButton* p = (CButton*)GetDlgItem(IDC_RADIODevice);
//p.SetCheck(1);
不行啊,错误提示不能从wtl 到atl什么的,是怎么会事情。怎样才能正确设置。

解决方案 »

  1.   

    刚看到有说//CButton* p = (CButton*)GetDlgItem(IDC_RADIODevice);
    //p.SetCheck(1); 
    -----------
    p->SetCheck(1); 
      

  2.   

    或直接使用API函数:
    GetDlgItem
    CheckDlgButton
      

  3.   

    CButton* p =(CButton*)GetDlgItem(IDC_RADIODevice); 
    p->SetCheck(1); 
    error C2440: 'type cast' : cannot convert from 'ATL::CWindow' to 'WTL::CButton *'
      

  4.   

    CButton p = GetDlgItem(IDC_RADIODevice);
    p.SetCheck(1);NND,自己搞定。atl害死人阿。