G
gggg
Unregistered / Unconfirmed
GUEST, unregistred user!
下面程序为什么没有反映?
procedure TForm1.Button1Click(Sender: TObject);
var
hCommFile : THandle;
i:integer;
PhoneNumber : string;
CommPort : string;
NumberWritten, ModemStat : dword;
begin
PhoneNumber := 'ATDT 2918615' + #13 + #10;
CommPort := 'COM1';
{Open the comm port}
hCommFile := CreateFile(PChar(CommPort),
GENERIC_WRITE,
FILE_SHARE_WRITE,
nil,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if hCommFile=INVALID_HANDLE_VALUE then
begin
ShowMessage('Unable to open '+ CommPort);
exit;
end
else
showmessage('open'+CommPort);
{Get the Modem Status}
if GetCommModemStatus(hCommFile, ModemStat) <> false then
begin
if ModemStat and MS_CTS_ON <> 0 then
ShowMessage('The CTS (clear-to-send) is on.');
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.')
else
showmessage('The ring indicator is off');
if ModemStat and MS_RLSD_ON <> 0 then
ShowMessage('The RLSD (receive-line-signal-detect) is on.')
else
ShowMessage('The RLSD (receive-line-signal-detect) is off.');
end;
{Dial the phone}
NumberWritten:=0;
if WriteFile(hCommFile,PChar(PhoneNumber)^,Length(PhoneNumber),NumberWritten,nil)=false then
begin
ShowMessage('Unable to write to ' + CommPort);
end;
CloseHandle(hCommFile);
end;
请各位大虾帮忙see,或者有什么别的解决办法?
谢谢!
procedure TForm1.Button1Click(Sender: TObject);
var
hCommFile : THandle;
i:integer;
PhoneNumber : string;
CommPort : string;
NumberWritten, ModemStat : dword;
begin
PhoneNumber := 'ATDT 2918615' + #13 + #10;
CommPort := 'COM1';
{Open the comm port}
hCommFile := CreateFile(PChar(CommPort),
GENERIC_WRITE,
FILE_SHARE_WRITE,
nil,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if hCommFile=INVALID_HANDLE_VALUE then
begin
ShowMessage('Unable to open '+ CommPort);
exit;
end
else
showmessage('open'+CommPort);
{Get the Modem Status}
if GetCommModemStatus(hCommFile, ModemStat) <> false then
begin
if ModemStat and MS_CTS_ON <> 0 then
ShowMessage('The CTS (clear-to-send) is on.');
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.')
else
showmessage('The ring indicator is off');
if ModemStat and MS_RLSD_ON <> 0 then
ShowMessage('The RLSD (receive-line-signal-detect) is on.')
else
ShowMessage('The RLSD (receive-line-signal-detect) is off.');
end;
{Dial the phone}
NumberWritten:=0;
if WriteFile(hCommFile,PChar(PhoneNumber)^,Length(PhoneNumber),NumberWritten,nil)=false then
begin
ShowMessage('Unable to write to ' + CommPort);
end;
CloseHandle(hCommFile);
end;
请各位大虾帮忙see,或者有什么别的解决办法?
谢谢!