안녕하세요! ApdComPort의 버퍼를 지워도 마찬가지로 Error가 생기네요
그래서, 제가 작업했던 Source를 올립니다. 제가 조금 급하거든요
도와주세요
****************************>>
unit extapid0;
interface
uses
WinTypes, WinProcs, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, AdTerm, AdPort, AdTapi, AdTStat, ExtCtrls,
OoMisc, AdModem;
type
TForm1 = class(TForm)
ApdTapiDevice1: TApdTapiDevice;
ApdTapiStatus1: TApdTapiStatus;
ApdTapiLog1: TApdTapiLog;
ApdTerminal1: TApdTerminal;
Dial: TButton;
Hangup: TButton;
ApdEmulator1: TApdEmulator;
ApdComPort1: TApdComPort;
Button1: TButton;
Memo1: TMemo;
ApdModem1: TApdModem;
procedure DialClick(Sender: TObject);
procedure HangupClick(Sender: TObject);
procedure ApdTapiDevice1TapiPortOpen(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure ApdComPort1TriggerAvail(CP: TObject; Count: Word);
procedure ApdTapiDevice1TapiPortClose(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
index : integer;
implementation
{$R *.DFM}
procedure TForm1.DialClick(Sender: TObject);
begin
ApdTapiDevice1.Dial('23');
Index := 0;
end;
procedure TForm1.HangupClick(Sender: TObject);
begin
ApdTapiDevice1.CancelCall;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ApdTapiDevice1.Comport.putstring('+++');
end;
procedure TForm1.ApdTapiDevice1TapiPortOpen(Sender: TObject);
begin
ApdComport1.FlushInBuffer;
ApdComPort1.FlushOutBuffer;
ApdTerminal1.StuffString(IntToStr(index) + '** Port Open **' + #13#10#13#10);
ApdTerminal1.ForcePaint;
Index := Index + 1;
end;
procedure TForm1.ApdTapiDevice1TapiPortClose(Sender: TObject);
begin
ApdTerminal1.StuffString('** Port Closed **' + #13#10#13#10);
ApdTerminal1.ForcePaint;
ApdTapiDevice1.Dial('23');
end;
procedure TForm1.ApdComPort1TriggerAvail(CP: TObject; Count: Word);
var
c : char;
received : string;
i : integer;
begin
received := '';
if count <> 0 then begin
for i := 1 to count do begin
c := ApdComPort1.GetChar ;
received := received + c;
end;
end;
if Trim(received) = 'login:' then begin
ApdTapiDevice1.ComPort.PutString('+++');
end
else if Trim(received) = 'OK' then begin
if ApdTapiDevice1.CancelCall then begin
ApdTerminal1.StuffString('** Immediately DisConnect **' + #13#10#13#10);
ApdTerminal1.ForcePaint;
ApdTapiDevice1.Dial('23');
end
else ApdTapiDevice1.CancelCall;
end;
end;
end.
|