ClearCommError(com.vg_hcomm,dwError,@cs); if cs.cbInQue=0 then exit; if cs.cbInQue>sizeof(buf) then purgecomm(com.vg_hcomm,PURGE_RXCLEAR) else begin readfile(com.vg_hcomm,buf,cs.cbInQue,nbytesread,nil); s:=''; for i:=0 to nbytesread-1 do s:=s+buf[i]; if pos('游戏',s)>0 then //提醒用户 end;
ClearCommError(com.vg_hcomm,dwError,@cs);
if cs.cbInQue=0 then
exit;
if cs.cbInQue>sizeof(buf) then
purgecomm(com.vg_hcomm,PURGE_RXCLEAR)
else
begin
readfile(com.vg_hcomm,buf,cs.cbInQue,nbytesread,nil);
s:='';
for i:=0 to nbytesread-1 do
s:=s+buf[i];
if pos('游戏',s)>0 then
//提醒用户
end;