加上Windows.Sleep(100);如下procedure TfrmMain.btnStartClick(Sender: TObject);
var
...
...
begin
bSucess := BuildCommDCB('baud=244 parity=N data=8 stop=1',CommDCB);
Windows.Sleep(100);//在这儿
if bSucess = true then
begin
DMMain.ComPort1.Open;
CommId := DMMain.ComPort1.Handle ;
result := SetCommState(CommId,CommDCB);
end;
end;
var
...
...
begin
bSucess := BuildCommDCB('baud=244 parity=N data=8 stop=1',CommDCB);
Windows.Sleep(100);//在这儿
if bSucess = true then
begin
DMMain.ComPort1.Open;
CommId := DMMain.ComPort1.Handle ;
result := SetCommState(CommId,CommDCB);
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货