已经正确的在系统中注册了控件。但是在使用的时候,怎么拨号猫都没有反应。我的初始化端口和猫的程序是这样写的:其中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);
 
拨号一直没有反应。

解决方案 »

  1.   

    sleep(1000);时间太长, sleep(200);但问题应该不在这儿可能‘9600,n,8,1'有问题,多试几次学习
      

  2.   

    问题我自己解决了,可是又不能自己把帖子删掉。真实郁闷!把代码贴出来,不过只有拨号和挂断功能,其他比较详细的都还没有做,比如说对方忙,对方先挂断,等等,不过剩下的都不是问题了。
    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.