AfxGetApp有关问题
AfxGetApp问题
如果((CChatServerDlg*)(AfxGetApp()->m_pMainWnd))->m_xx.SetWindowText(c2);中AfxGetApp是获得CWinAp对象指针,但是如果新建一个类如CSystem而非主对话框类,上面的语句要怎么改才能访问新类的成员变量?
------解决方案--------------------
最简单的,CSystem发送消息到主窗口类中。
------解决方案--------------------
发送消息,或者使用全局变量
如果((CChatServerDlg*)(AfxGetApp()->m_pMainWnd))->m_xx.SetWindowText(c2);中AfxGetApp是获得CWinAp对象指针,但是如果新建一个类如CSystem而非主对话框类,上面的语句要怎么改才能访问新类的成员变量?
------解决方案--------------------
最简单的,CSystem发送消息到主窗口类中。
------解决方案--------------------
发送消息,或者使用全局变量