void CChat_simulate_cView::OnBNSend() 
{
  CChat_simulate_cDoc* pDoc = GetDocument();  ChatInfo* pInfo = new ChatInfo;
  CString  szStrTmp;  UpdateData(TRUE);  m_Send_Content.GetWindowText(pInfo->m_Content);  pInfo->m_New = 1;   m_Self_ID.GetWindowText(szStrTmp);
  pInfo->m_WhoSend = szStrTmp;  m_Dest_ID.GetWindowText(szStrTmp);
  pInfo->m_WhoRecive = szStrTmp;  int szSize = pDoc->m_CurrentChatPersorn->m_MapUserChatInfo.size(); 
  pDoc->m_CurrentChatPersorn->m_MapUserChatInfo[szSize] = pInfo;
  ......................................
}
各位大哥好!上面m_Send_Content,m_Self_ID,m_Dest_ID都是一个编辑框的CEdit类成员变量,可调试时,下面三个语句:
  m_Send_Content.GetWindowText(pInfo->m_Content);
  m_Self_ID.GetWindowText(szStrTmp);
  m_Dest_ID.GetWindowText(szStrTmp);
不能把自己的内容写入szStrTmp中!甚至,于此时,连m_Send_Content等都处于:
CXXX0030:error:expression can not be evaluated 状态!谢谢大家能帮我指点一二!谢谢!

解决方案 »

  1.   

    m_Send_Content,m_Self_ID,m_Dest_ID都是一个编辑框的CEdit类成员变量,这个都是CONTROL类型得吗?
    看代码不像有错,建议你查查别得地方
      

  2.   

    用这个试试:
    CEdit *p = (CEdit *)GetDlgItem(CEdit控件的ID);
    p->GetWindowText(szStrTmp);
      

  3.   

    用这个试试
    CEdit *p = (CEdit *) GetDlgItem(CEdit控件ID);
    p->GetWindowText(szStrTmp);
      

  4.   

    ChatInfo struct结构是什么,贴出来看看
      

  5.   

    这里也许有解:
    lsq004.myrice.com
      

  6.   

    m_Send_Content先检查一下是否有效
      

  7.   

    谢谢大家!!
    typedef struct _ChatInfo
    {
             int       m_Serial;
    int       m_New;
    CString   m_datetime;
    CString   m_WhoSend;
    CString   m_WhoRecive;
    CString   m_Content;}ChatInfo;m_Send_Content用跟踪显示是:
    CXXX0030:error:expression can not be evaluated ,这说明它无效吧?它的值连vc环境都不能evaluated了!
    ChatInfo变量经过上述的赋值后,也全部原封不动的显示:CXXX0030:error:expression can not be evaluated,赋值不成功!
      

  8.   

    看不出问题~_~
    用这种办法试试,看有没有出错:CEdit *p = (CEdit *)GetDlgItem(CEdit控件的ID);
    p->GetWindowText(pInfo->m_Content);
      

  9.   

    看一下DoDataExchange()中是否有如下代码:
    m_Send_Contect为CEdit类型:
    ......
    DDX_Control(ID, m_Send_Content);
    ......
      

  10.   

    恩!谢谢你!eastred(~Vampire~)  
    我试了下:
    CEdit *p = (CEdit *)GetDlgItem(CEdit控件的ID);
    p->GetWindowText(pInfo->m_Content);
    可仍一样:可能是其他哪里出了问题吧!
      

  11.   

    看看你的代码!
    [email protected]
      

  12.   

    你的编译设置有问题建议Reset(恢复默认值后)试试。
      

  13.   

    subclass是替换窗口过程,并且同时Attatch
    Attatch并未替换窗口过程,适合简单操作
      

  14.   

    为什么不把控件关联到文档的变量?void CChat_simulate_cView::DoDataExchange
    {
    CChat_simulate_cDoc* pDoc = GetDocument();
    DDX_Text(pDX,ControlID,pDoc->m_strSomeMember);
      

  15.   

    谢谢你!checkyvc6(checkyvc6) 我按你的建议reset后就可以了! 谢谢大家!:)