void CAboutDlg::OnButton1() 
{
// TODO: Add your control notification handler code here
CString strText;
m_strCombo.GetWindowText(strText);
}怎么会报“error C2039: 'GetWindowTextA' : is not a member of 'CString'”这个错阿?

解决方案 »

  1.   

    看样子,m_strCombo好像是CString类型,你把:
    CString m_strCombo;
    改成:
    CComboBox m_strCombo;
      

  2.   

    在类向导里的member varaiables 里将m_strCombo改为CString
      

  3.   

    to chenweihello(呼噜噜~~~~~~~~~~) :就问这个呀,错在哪啦,为什么报这个错阿?
    to EricHxy(龙真) :我没有申明CString m_strCombo呀,m_strCombo是一个ComboBox,我是申明了CString strText
    to rabithao(兔巴哥):在类向导里的member varaiables 里m_strCombo,默认就是CString啊,没改过!还有谁知道吗?
      

  4.   

    在类向导里的member varaiables 里将m_strCombo改为 CComboBox.
      

  5.   

    Because it just like the error message said "'GetWindowText' : is not a member of 'CString'". Also, you said "m_strCombo是一个ComboBox", so you should declared as CComboBox, GetWindowText is one of its member function so you can call it.For more information please check with MSDN.
      

  6.   

    这位同志好像是刚学VC的,其实你对VC里的一切东西都应该透过其表面操作而看到其内在代码的实际操作,那样才学的比较深入,比较快速。就如上边那个问题吧。其实在类向导里的member varaiables 中定义m_strCombo的时候,实际的代码就是把一个变量与那个ComboBox控件相绑定,其默认为CString,也就是说明你这个变量的使用必须受CString类成员函数的限制,若将其类型改为CComboBox,则你使用时的成员函数也当然就受到CComboBox类成员的限制。GetWindowText是属于CComboBox类的,那你当然不能用一个CString类型的变量去调用他了。
      

  7.   

    在ClassWizzard->Member Variable 选项卡中把m_strCombo的类型改为Control.