MScomm32.ocx 不能拔号的问题? (100分)

L

lwluser

Unregistered / Unconfirmed
GUEST, unregistred user!
if Comm.PortOpen then
begin
Comm.Output:='';
Sleep(1100:
Comm.Output:='+++'+Chr(13)+Chr(10);
Sleep(1100);
Comm.Output:='ATE1M0Q0S0=3V14&C1&D3&K0&&S0'+Chr(13)+Chr(10);
Sleep(1100);
comm.OutBufferCount:=0;
Comm.InBuffercount:=0;
Comm.SThreshold:=1;
Comm.RThreshold:=1;
Sleep(1200);
Comm.Output:='+++';
Sleep(1200);
Comm.Output:='ATDT163';
end



为什么就是不能拔号?
 
Output之后是不是还要ProcessMessages,等待读入“ok”再继续发啊
 

var
Form1: TForm1;
hCommFile : THandle;
////////////////////////////////
// 用Modem拨号
////////////////////////////////
procedure TForm1.Button7Click(Sender: TObject);
var
PhoneNumber : string;
CommPort : string;
NumberWritten : dword;
begin
PhoneNumber := 'ATDT 163' + #13 + #10;
CommPort := 'COM3';
{Open the comm port}
hCommFile := CreateFile(PChar(CommPort),GENERIC_WRITE,0,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
if hCommFile=INVALID_HANDLE_VALUE then
begin
ShowMessage('Unable to open '+ CommPort);
exit;
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;
end;
////////////////////////////////
// 关闭Modem拨号
////////////////////////////////
procedure TForm1.Button8Click(Sender: TObject);
begin
{Close the port}
CloseHandle(hCommFile);
end;
 
如果你在通信中,Modem已连接,当然不能了,哪有拨两次号码的
 
接受答案了.
 
顶部