ClearCommError(hComm,dwError,@CS); //取得状态
if cs.cbInQue =0 then
begin
exit; //缓冲区为空,则退出
end;
ReadFile(hComm, DataByte,cs.cbInQue,nBytesRead,nil); // 接收COM 的数据 for i:=0 to nBytesRead-1 do
begin
。
end;在上面的代码中为什么程序长时间(8小时)运行以后,nBytesRead取的值变成了4,正常运行时这个地方应该是18.
为什么会出现这种现象呢。数据是在com2口接收的。
if cs.cbInQue =0 then
begin
exit; //缓冲区为空,则退出
end;
ReadFile(hComm, DataByte,cs.cbInQue,nBytesRead,nil); // 接收COM 的数据 for i:=0 to nBytesRead-1 do
begin
。
end;在上面的代码中为什么程序长时间(8小时)运行以后,nBytesRead取的值变成了4,正常运行时这个地方应该是18.
为什么会出现这种现象呢。数据是在com2口接收的。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货