怎么用SerialPort类 里面receivechar()函数接收数据显示
如何用SerialPort类 里面receivechar()函数接收数据显示
主要代码如下:
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);
。。。
}
如何能够时时监听并接收数据并显示在编辑框中 ???在对话框中应该怎样引用接收数据的函数
------解决方案--------------------
它不是有个消息发送么,WM_COMM_RXCHAR,你在你的程序中接收这个消息就可以了啊
主要代码如下:
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 串口 异步通信
------解决方案--------------------
它不是有个消息发送么,WM_COMM_RXCHAR,你在你的程序中接收这个消息就可以了啊