主要代码如下:
void SerialPort::ReceiveChar(SerialPort* port, COMSTAT comstat)
{。
。
for (;;)
{
EnterCriticalSection(&port->m_csCommunicationSync);
bResult = ClearCommError(&port->m_hComm,&dwError,&comstat);
LeaveCriticalSection(&port->m_csCommunicationSync);
if (comstat.cbInQue == 0)
{
break; //break out when all bytes has been read;
}
if (bRead)
{
bResult = ReadFile(port->m_hComm,&RXBuff,1,&BytesRead,&port->m_ov);
}
如何能够时时监听并接收数据并显示在编辑框中 ???在对话框中应该怎样引用接收数据的函数 MFC 串口 异步通信
void SerialPort::ReceiveChar(SerialPort* port, COMSTAT comstat)
{。
。
for (;;)
{
EnterCriticalSection(&port->m_csCommunicationSync);
bResult = ClearCommError(&port->m_hComm,&dwError,&comstat);
LeaveCriticalSection(&port->m_csCommunicationSync);
if (comstat.cbInQue == 0)
{
break; //break out when all bytes has been read;
}
if (bRead)
{
bResult = ReadFile(port->m_hComm,&RXBuff,1,&BytesRead,&port->m_ov);
}
如何能够时时监听并接收数据并显示在编辑框中 ???在对话框中应该怎样引用接收数据的函数 MFC 串口 异步通信
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货