我初学C++,还请朋友们多多帮忙,先谢谢了!
void LogOn::OnButton1() 
{
    CString c_user,c_password,Flag;
     m_id.GetWindowText(c_user);
     m_pwd.GetWindowText(c_password);
为啥报错 'GetWindowTextA' : is not a member of 'CString'

解决方案 »

  1.   

    m_id,m_pwd,这两个是什么的对象??你贴完整代码吧
      

  2.   

    为啥报错 'GetWindowTextA' : is not a member of 'CString'意思是,m_id.这个对象的类型没有封装有这个函数'GetWindowText,所以报错,建议重新定义对应类型。
      

  3.   

    CString确实没有GetWindowText这个成员函数啊
    我怀疑你是将m_id和m_pwd作为编辑框的关联变量的吧?最大的可能是你选错了关联变量的类型,应该是control型的,而不是value。
      

  4.   

    看来你是给控件关系了value为CString的对象了,你应该关联control类型,CEdit的对象
      

  5.   

    在ctrl+w中增加m_id和m_pwd变量时category应该是control类型
      

  6.   

    m_id.GetWindowText(c_user);要写成: m_id.GetWindowText(c_user.GetBuffer());
      

  7.   

    GetWindowTextA本来就不是CString的成员啊
      

  8.   

    m_id.GetWindowText(c_user); 
      m_pwd.GetWindowText(c_password);
    请确定你的m_id和m_pwnd的类型,应该是CString类型,而不是控件类型吧
      

  9.   

    既然你直接关联的CString而不是Control型的。直接这样就可以了:
    UpdateData(TRUE);
    c_user = m_id;
    c_password = m_pwd;
    对于CEdit关联CString,要比Control型变量方便多了。
      

  10.   

    如果要修改CEdit的内容,直接去给m_id和m_pwd赋字符串就可以了,不过要记得UpdateData(FALSE);更新一下。
      

  11.   

    在ctrl+w中增加m_id和m_pwd变量时category应该是control类型
      

  12.   

    为啥报错 'GetWindowTextA' : is not a member of 'CString'
    改成GetWindowText
    或将CString c_user,c_password,Flag;
    原因
    VC6用CString类被VC8废除改用CStringA
      

  13.   

    修改为啥报错 'GetWindowTextA' : is not a member of 'CString'
    改成GetWindowText
    或将CString c_user,c_password,Flag;
    改成CStringA原因
    VC6用CString类被VC8废除改用CStringA
      

  14.   

    LS,人家明明是把CEdit控件变量捆绑成CString而不是CEdit型的了。之所以是GetWindowTextA,因为它用的VC6,而且选择了ANSI方式的MFC。人家这个错误说的是GetWindowText不是m_id(CString)的成员变量,跟你说的那几个c_user,c_password,Flag八辈子关系都没有。
      

  15.   

    CString  m_id,m_pwd;  需要这样定义才可以!