如何通过modem获得该modem的端口(200)

  • 主题发起人 主题发起人 quicksoft
  • 开始时间 开始时间
Q

quicksoft

Unregistered / Unconfirmed
GUEST, unregistred user!
程序设想:1、在comobox下拉中让用户选择该本机安装的modem(已经实现)2、根据用户选择的modem,我获得该modem所占用的端口,然后进行at指令目前没有办法获得端口,请问如何解决
 
function testModem(Modem:Integer):Integer; var CommPort:string; hCommFile:THandle; ModemStat:Dword; begin Result := 1; CommPort := 'COM' + inttostr(Modem); hCommFile := createfile(PChar(CommPort), 0, //generic_read, 0, nil, open_existing, 0, 0); if hCommFile=INVALID_HANDLE_VALUE then exit; {Get the Modem Status} if GetCommModemStatus(hCommFile, ModemStat) <> false then begin if ModemStat and MS_CTS_ON <> 0 then begin // ShowMessage('The CTS (clear-to-send) is on.'); Result := 0; CloseHandle(hCommFile); exit; end; if ModemStat and MS_DSR_ON <> 0 then ShowMessage('The DSR (data-set-ready) is on.'); if ModemStat and MS_RING_ON <> 0 then ShowMessage('The ring indicator is on.'); if ModemStat and MS_RLSD_ON <> 0 then ShowMessage('The RLSD (receive-line-signal-detect) is on.'); end; end; for i := 1 to 5 do begin if TestModem(i) = 0 then begin Receive.Lines.Add('Modem在串口' + inttostr(i) + '上');http://topic.csdn.net/t/20050525/10/4033849.html
 
后退
顶部