📄 d064.bmp.txt
字号:
// Gain ownership of the comm port critical section.
//This process guarantees no other part of this program is using the port object.
EnterCnticaISection(&port->m_csCommunicationSync);
bResult = ClearCommError(port->m_hComm, &dwError, &comstat);
LeaveCnticalSection(&port->m_csCommunicationSync) ;
if (comstat.cbInQue - 0)
{
//break out when all bytes have been read
break;
}
EnterCriticalSection(&port->m_csCommunicationSync);
if (bRead)
{
bResult = ReadFile(port->m_hComm, // Handle to COMM port
&RXBuff, // RX Buffer Pointer
1, 11 Read one byte
&BytesRead, // Stores number of bytes read
&port->m_ov); // pointer to the m_ov structure
//deal with the error code
if (!bResult)
{
switch (dwError = GetLastError(》
. {
case ERROR_IO_PENDING:
{
// asynchronous i/o is still in progress
//Proceed on to GetOverlappedResults();
bRead = FALSE; '
break;
}
default:
{
//Another error has occured. Process this error.
port->ProcessErrorMessage( " ReadFile0 ");
break;
}
}
else
{
// ReadFile() retumed complete. It is not necessary to call GetOverlappedResults()
bRead = TRUE;
}
} //close if (bRead)
if (!bRead)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -