IClient* CSmartClient::_Connect() { if ( !IsConnecting() ) return NULL; #ifdef CONSOLE_DEBUG cprintf( "Begin connect\n"); #endif IClient *pClient = NULL; /* * There is connectted the heaven by the rainbow */ pfnCreateClientInterface pClientFactroyFun = ( pfnCreateClientInterface )( m_theRainbowLib.GetProcAddress( _T( "CreateInterface" ) ) ); IClientFactory *pClientFactory = NULL; if ( pClientFactroyFun && SUCCEEDED( pClientFactroyFun( IID_IClientFactory, reinterpret_cast< void ** >( &pClientFactory ) ) ) ) { pClientFactory->SetEnvironment( 1024 * 1024 ); pClientFactory->CreateClientInterface( IID_IESClient, reinterpret_cast< void ** >( &pClient ) ); SAFE_RELEASE( pClientFactory ); } if ( pClient ) { pClient->Startup(); pClient->RegisterMsgFilter( reinterpret_cast< void * >( this ), EventNotify ); if ( FAILED( pClient->ConnectTo( m_sSvrIP.c_str(), m_nSvrPort ) ) ) { pClient->Cleanup(); SAFE_RELEASE( pClient ); #ifdef CONSOLE_DEBUG cprintf( "Reconnect Failed\n"); #endif ::Sleep( 5000 ); return NULL; } else { SetClientStatus(enumClientVerify); } } return pClient; }