AfxGetMainWnd返回的现程的主窗口,你在主线程以外调用他得不到你要的mainframe:
修改:
void CClientSocket::OnReceive(int nErrorCode)
{
CMainFrame * pMainWnd;
pMainWnd=(CMainFrame *)::AfxGetApp()->m_pMainWnd;
BOOL b;
if (!(pMainWnd->GetRecStatus()))
{
b=TRUE;
}
else
{
b=FALSE;
}
}vc,vb都挺优秀,关键在于你不小心.
多看看MSDN
修改:
void CClientSocket::OnReceive(int nErrorCode)
{
CMainFrame * pMainWnd;
pMainWnd=(CMainFrame *)::AfxGetApp()->m_pMainWnd;
BOOL b;
if (!(pMainWnd->GetRecStatus()))
{
b=TRUE;
}
else
{
b=FALSE;
}
}vc,vb都挺优秀,关键在于你不小心.
多看看MSDN
AfxGetMainWnd返回当前线程的主窗口,你在主线程以外调用他得不到你要的mainframe:
...
If the function is called from a secondary thread in the application, the function returns the main window associated with the thread that made the call.
以为the main window就是程序的主窗口,实在是经验不足!!!