|
procedure TForm1.Button1Click(Sender: TObject);rssLinux联盟 varrssLinux联盟 CommPort : string;rssLinux联盟 hCommFile : THandle;rssLinux联盟 ModemStat : DWord;rssLinux联盟 beginrssLinux联盟 CommPort := 'COM2';rssLinux联盟 {Open the comm port}rssLinux联盟 hCommFile := CreateFile(PChar(CommPort),rssLinux联盟 GENERIC_READ,rssLinux联盟 0,rssLinux联盟 nil,rssLinux联盟 OPEN_EXISTING,rssLinux联盟 FILE_ATTRIBUTE_NORMAL,rssLinux联盟 0);rssLinux联盟 if hCommFile = INVALID_HANDLE_VALUE thenrssLinux联盟 beginrssLinux联盟 ShowMessage('Unable to open '+ CommPort);rssLinux联盟 exit;rssLinux联盟 end;rssLinux联盟 {Get the Modem Status}rssLinux联盟 if GetCommModemStatus(hCommFile, ModemStat) <> false then beginrssLinux联盟 if ModemStat and MS_CTS_ON <> 0 thenrssLinux联盟 ShowMessage('The CTS (clear-to-send) is on.');rssLinux联盟 if ModemStat and MS_DSR_ON <> 0 thenrssLinux联盟 ShowMessage('The DSR (data-set-ready) is on.');rssLinux联盟 if ModemStat and MS_RING_ON <> 0thenrssLinux联盟 ShowMessage('The ring indicator is on.');rssLinux联盟 if ModemStat and MS_RLSD_ON <> 0 thenrssLinux联盟 ShowMessage('The RLSD (receive-line-signal-detect) isrssLinux联盟 on.');rssLinux联盟 end;rssLinux联盟 {Close the comm port}rssLinux联盟 CloseHandle(hCommFile);rssLinux联盟 end;rssLinux联盟 如何知道Modem接在哪个COMrssLinux联盟 = = = = = = = = = = = = = = = = = = = = = = = = = = = =rssLinux联盟 HKEY_CURRENT_USERMonitor其中有modem的名字和com口
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|