各位老大,救命呀!程序如下:if(Connect(m_csIp,PORT)==0){
    UINT iErrorCode=GetLastError();
    if(iErrorCode!=WSAEWOULDBLOCK){
    m_nConnectStatus=ECONNECT_FAIL;
    CloseProgressDlg();
    return m_nConnectStatus;
}
else
{
    MSG msg;
    UINT tm=GetTickCount();
    while(m_nConnectStatus!=ECONNECT_OK)      
    //m_nConnectStatus会在onConnect之中设为ECONNECT_OK,如果连接成功的话
    {
        int nRet=GetMessage(&msg,NULL,0,0);
        if(nRet==0)
        {
            m_nConnectStatus=ECONNECT_FAIL;
        }
        if(m_nConnectStatus==ECONNECT_FAIL)
        {
            return m_nConnectStatus;
        }
        if(nRet!=-1)
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        if((GetTickCount()-tm)>OPERATION_TIMEOUT)
       {
            m_nConnectStatus=ECONNECT_TIMEOUT;
        }
        return m_nConnectStatus;
    }
}