Author: MosesMoses
Date: Jan 4, 2008 07:06
编程的环境是在 Windows 下对串口进行读写的操作.
//开始的事件是这样声明的
OVERLAPPED m_osWrite;
m_osWrite.hEvent = CreateEvent(NULL,TRUE,FALSE,NULL);
//调用的代码:
//////////////////////////////////////////////////////////
if(m_pDevice->m_strDeviceModel == "yyyyy")
{
strcpy(sBuf,"MA!");
dwLength = 3;
}
int fState;
DWORD dwBytesWritten = 0;//实际发送字节数
DWORD dwErrors = 0;
try
{
m_port.ClearError(dwErrors);
if (dwErrors != 0)
{
dwErrors = 0;
}
fState = m_port.Write(sBuf,dwLength,m_osWrite...
|