我终于明白了,这个类没有办法同步发送数据,看它的cpp文件中的初始化:
m_hComm = CreateFile(szPort,// communication port string (COMX)
GENERIC_READ | GENERIC_WRITE, // read/write types
0, // comm devices must be opened with exclusive access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
FILE_FLAG_OVERLAPPED, // Async I/O
0); // template must be 0 for comm devices
FILE_FLAG_OVERLAPPED被设置为异步,并且不能改为同步,要同步的话用其他类吧,比如:
http://blog.chinaunix.net/u/32550/showart_365425.html