ASSERT(pState->m_hSocketWindow != NULL);出错?
awjx 2005-09-21 05:48:08 我用CSocket写通信程序,但执行到下面的函数时总出错,是什么原因?
下面的函数是 ...\MFC\SRC\SOCKCORE.CPP 里的函数。
BOOL CSocket::PumpMessages(UINT uStopFlag)
{
// The same socket better not be blocking in more than one place.
ASSERT(m_pbBlocking == NULL);
_AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;
ASSERT(pState->m_hSocketWindow != NULL);
BOOL bBlocking = TRUE;
m_pbBlocking = &bBlocking;
CWinThread* pThread = AfxGetThread();
// This is not a timeout in the WinSock sense, but more
// like a WM_KICKIDLE to keep message pumping alive
UINT nTimerID = ::SetTimer(pState->m_hSocketWindow, 1, m_nTimeOut, NULL);
if (nTimerID == 0)
AfxThrowResourceException();
BOOL bPeek = TRUE;
...
}
为什么 “ASSERT(pState->m_hSocketWindow != NULL);”会失败?
我搞不定了,帮忙啊!