已经正确的在系统中注册了控件。但是在使用的时候,怎么拨号猫都没有反应。我的初始化端口和猫的程序是这样写的:其中AXPHONE是控件的名字。端口是3,‘9600,n,8,1'
try
if axphone.PortOpen then
begin
axphone.PortOpen:=false;
sleep(1000);
end;
if not axphone.PortOpen then
begin
axphone.PortOpen:=true;
end;
except
on e:exception do
begin
showmessage('MODEM 初始化失败,请重新拨号');
initmodem;
end;
end; axphone.InBufferCount:=0;
axphone.InputLen:=0;
axphone.RThreshold:=1;
axphone.DTREnable:=true;
axphone.RTSEnable:=true;
axphone.Output:='ATE1M0Q0S0=3V1X4&C1&D3&K0&S0'+CHR(13);
拨号一直没有反应。
try
if axphone.PortOpen then
begin
axphone.PortOpen:=false;
sleep(1000);
end;
if not axphone.PortOpen then
begin
axphone.PortOpen:=true;
end;
except
on e:exception do
begin
showmessage('MODEM 初始化失败,请重新拨号');
initmodem;
end;
end; axphone.InBufferCount:=0;
axphone.InputLen:=0;
axphone.RThreshold:=1;
axphone.DTREnable:=true;
axphone.RTSEnable:=true;
axphone.Output:='ATE1M0Q0S0=3V1X4&C1&D3&K0&S0'+CHR(13);
拨号一直没有反应。
Jeff20040819(最爱Delphi,C#——苦练内功中),你运气好,要是我结贴时候只有你一个人顶的话,只好把两个帖子的160分都给你了。unit call_out;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, MSCommLib_TLB, StdCtrls;type
TForm1 = class(TForm)
AXPhone: TMSComm;
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Label2: TLabel;
Label3: TLabel;
Edit2: TEdit;
Label4: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure AXPhoneComm(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
call_num:integer;
procedure InitModem;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.InitModem;
begin
try
if axphone.PortOpen then
begin
axphone.PortOpen:=false;
//sleep(1000);
end;
if not axphone.PortOpen then
begin
axphone.PortOpen:=true;
end;
except
on e:exception do
begin
showmessage('MODEM 初始化失败,请重新拨号');
// initmodem;
end;
end;
axphone.InBufferCount:=0;
axphone.InputLen:=0;
axphone.RThreshold:=1;
axphone.DTREnable:=true; //是否使DTR信号线有效,DTR
//指示计算机在等待接受传输
axphone.RTSEnable:=true;
// axphone.Output:='+++';
// sleep(1000);
//axphone.OutBufferCount:=0;
//axphone.Output:='ATE1m1Q0S0=3V1X4&C1&D3&K0&S0#10#13';
end;procedure TForm1.FormCreate(Sender: TObject);
begin
call_num:=0;
self.InitModem;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
if call_num>=1 then
initmodem;
{if axphone.PortOpen=true then
showmessage('ok'); }
axphone.OutBufferCount:=0;
if edit2.Text='' then //检测分机号码是否为空
axphone.Output:='ATDT'+trim(edit1.Text) + chr(13)
else
axphone.Output:='ATDT'+trim(edit1.Text)+',,'+trim(edit2.Text)+chr(13);
call_num:=call_num+1;
//showmessage(inttostr(axphone.OutBufferCount));
label3.Caption:='正在拨号中';
if axphone.CDHolding then //检测该属性确定是否正在通话中
label3.Caption:='通话中'; {if axphone.CTSHolding then //确定是否可以发送数据
showmessage('可以发送数据'); } //showmessage(inttostr(axphone.commid));//返回控件的句柄 //showmessage(inttostr(axphone.CommPort));返回端口号 {if axphone.DSRHolding then //检测是否做好操作准备,由
showmessage('作好操作准备'); //modem向计算机发出 } //showmessage('输出缓冲字符数:'+inttostr(axphone.OutBufferCount));
end;procedure TForm1.AXPhoneComm(Sender: TObject);
begin
case axphone.CommEvent of
1001: ;
end;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
axphone.OutBufferCount:=0;
axphone.Output:='+++' + chr(13);
axphone.Output:='ATH' + chr(13);
axphone.PortOpen := false;
end;end.