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

解决方案 »

  1.   

    修改:
    AfxGetMainWnd返回当前线程的主窗口,你在主线程以外调用他得不到你要的mainframe:
    ...
      

  2.   

    非常感谢,看了半天MSDN,
    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就是程序的主窗口,实在是经验不足!!!