设为首页 加入收藏

TOP

MFC问题集之注意变量的作用域
2014-11-17 15:00:25 来源: 作者: 【 】 浏览:63
Tags:MFC 问题 注意 变量 作用

  CString lastZZHS ;


  if(int index=m_ListCtrl.GetItemCount()-1)


  {


  lastZZHS = m_ListCtrl.GetItemText(index,3);


  AfxMessageBox(lastZZHS);


  }


  //正常显示


  if(int lastindex =(m_ListCtrl.GetItemCount()-1)


  {


  CString lastZZHS;


  lastZZHS = m_ListCtrl.GetItemText(lastindex,3);


  AfxMessageBox(lastZZHS);


  }


  //不正常显示,MessageBox发送出去, lastZZHS因为是局部变量,执行完便被销毁。


  编辑特别推荐:


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇GoogleMap编码折线算法 下一篇MFC问题集之CString/string/char*..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: