d066.bmp.txt
来自「Visual C++通信编程实例」· 文本 代码 · 共 45 行
TXT
45 行
// 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 + =
减小字号Ctrl + -
显示快捷键?