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

📄 d066.bmp.txt

📁 Visual C++通信编程工程实例精解(附盘)
💻 TXT
字号:
// Initailize variables
port >m_ov.Offset = 0;
port->m_ov.OffsetHigh = 0;
           // Clear buffer
   PurgeComm(port->m_hComm, PURGE_RXCLEAR I PURGE_TXCLEAR I PURGE_
 I PURGE_TXABORT);
           bResult = WriteFile(port->m_hComm,                                       // Handle to COMM Port
                            port->m_szWriteBuffer,                         // Pointer to message buffer in calling finction
               strlen《char*)port->m_szWriteBuffer),    //Length ofmessage to send
                        &BytesSent,                                           // Where to store the number of bytes sent
                      &port->m_ov);                                        // Overlapped structure
            // deal with any error codes
         if (!bResult)
         {
                 DWORD dwError = GetLastError():
              switch (dwError)
                   {
                        case ERROR_IO PENDING:
                                       {
                                                               // continue to GetOverlappedResults0
                                            BytesSent = 0;
                                        bWrite = FALSE;
    break;
                                        }
  default:
                                        {
                                                       // all other error codes
                                                                                                               port->ProcessErrorMessage( "WriteFile0 ");
                                        }
                    }
          }
 else
          {
LeaveCriticalSection(&port->m_csCommunicationSync),
          }
 } // end if(bWrite)
if ( !bWrite)
{
        bWrite = TRUE;
         bResult = GetOverlappedResult(port->m_hComm,    //Handle to COMM port
                                                                     &port->m_ov,             // Overlapped structure
                                                             &BytesSent,              // Stores number of bytes sent
                                                                                 TRUE);                             // Wait flag
LeaveCriticalSection(&pcnt->m_csCommurucationSync),

⌨️ 快捷键说明

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