Как узнать, есть ли в приёмном буфере RS232 данные? |
Previous Top Next |
При помощи функции ClearCommError можно узнать, сколько байт данных находится в буфере приёма (и буфере передачи) последовательного интерфейса.
Code: |
procedure DataInBuffer(Handle: THandle; var InQueue, OutQueue: integer); var ComStat: TComStat; e: integer; begin if ClearCommError(Handle, e, @ComStat) then begin InQueue := ComStat.cbInQue; OutQueue := ComStat.cbOutQue; end else begin InQueue := 0; OutQueue := 0; end; end; |
©Drkb::01344
Взято из http://forum.sources.ru