HRESULT CSocketSelectDlg::ThreadStart( ) { HRESULT hResult; if (m_hThread == NULL) { m_hThread = CreateThread(NULL, 0, (PTHREAD_START_ROUTINE) ThreadProc, (LPVOID) this, CREATE_SUSPENDED, &m_dwThdId); if (m_hThread != NULL) { hResult = vciEnumDeviceOpen((PHANDLE) &m_hDevEnu); if (hResult == VCI_OK) ResumeThread(m_hThread); else ThreadStop(TRUE); } else { hResult = GetLastError(); } } else { hResult = NO_ERROR; } return(hResult); }
CSocketSelectDlg::~CSocketSelectDlg() { ThreadStop(TRUE); m_hCurDev = INVALID_HANDLE_VALUE; m_hSelDev = NULL; m_lCtrlNo = -1; }
BOOL CSocketSelectDlg::OnWmDestroy(WPARAM wParam, LPARAM lParam) { // // terminate update thread // ThreadStop(TRUE); // // clear device list // DeviceListClear(); UpdateView(NULL); return(FALSE); }
/****************************************************************************** 处理名 : 停止处理 函数名 : Stop() 参数 : 无 返回值 : 无 ******************************************************************************/ int CChannelItem::Stop(){ printfs(1, "<CChannelItem>Stop command received!"); ThreadStop(); m_bStarted = false; return 0; }