⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d062.bmp.txt

📁 Visual C++通信编程工程实例精解(附盘)
💻 TXT
字号:
62
//begin forever loop.     This loop will run as long as the thread is alive.
 {
     bResult = WaitCommEvent(port->m_hComm, &Event, &port->m_ov);
              if ( !bResult)
           {
                       //If WaitCommEvent() retums FALSE, process the last error to determin the reason.
                   switch (dwError = GetLastError0)
                     {
                 case ERROR_IO_PENDING:
                               {
    break;
                               }
                case 87:
                               {
             break; .
 default:
                               {
                                                                                             port->ProcessErrorMessage( "WaitCommEvent() ");
    break;
                                }
                      }
            }
     else                                      .
            {
                     bResult = ClearCommError(port->m_hComm, &dwError, &comstat);                  .
                        if (comstat.cbInQue == 0)
  continue;
                   }          // end if bResult
// Main wait function.     This function will normally block the thread
//until one of nine events occur that require action.
 Event = WaitForMultipleObjects(3, port->m_hEventArray, FALSE, INFINITE);
switch (Event)
{
case 0:
          {
                      // Shutdown event.    This is event zero so it will be
                         // the higest priority and be serviced first.
                  port->m_bThreadAlive = FALSE;
// Kill this thread.     break is not needed, but makes me feel better
AfxEndThread(100);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -