首页  编辑  

API 拨号

Tags: /超级猛料/Network.网络通讯/FTP和拨号/   Date Created:

function tapiRequestMakeCall(DestAddress, AppName,

 CalledParty, Comment: PChar): Longint; stdcall; external 'TAPI32.DLL';

procedure TForm1.Button1Click(Sender: TObject);

var

 PhoneNumber, AppName: array[0..255] of Char;

begin

 PhoneNumber := '1234567890';

 StrPCopy(AppName, Application.Title);

 tapiRequestMakeCall(PhoneNumber, AppName, '', '');

end;

---------------------------------------

 TAPIMAXDESTADDRESSSIZE  = 80;

 TAPIMAXAPPNAMESIZE      = 40;

 TAPIMAXCALLEDPARTYSIZE  = 40;

 TAPIMAXCOMMENTSIZE      = 80;

Function  DialPhone (PhoneNbr, CalledParty, Comment : String) : Boolean;

Var

 MyPhoneNbr : Pchar;

 MyAppName : Pchar;

 MyCalledParty : Pchar;

 MyComment : Pchar;

Begin

 Result := false;

 If (length(PhoneNbr) > TAPIMAXDESTADDRESSSIZE) or

    (length(CalledParty) > TAPIMAXCALLEDPARTYSIZE) or

    (length(Comment) > TAPIMAXCOMMENTSIZE) then

   exit;

 myPhoneNbr := StrAlloc(TAPIMAXDESTADDRESSSIZE);

 MyAppName := StrAlloc(TAPIMAXAPPNAMESIZE);

 MyCalledParty := StrAlloc(TAPIMAXCALLEDPARTYSIZE);

 MyComment := StrAlloc(TAPIMAXCOMMENTSIZE);

 try

   StrPCopy(MyPhoneNbr, PhoneNbr);

   StrPCopy(MyCalledParty, CalledParty);

   StrPCopy(MyComment, Comment);

   StrPCopy(MyAppName, 'Whatever');

   Result := tapiRequestMakeCall(MyPhoneNbr, MyAppName,

                                 MyCalledParty,MyComment) = 0;

 finally

   StrDispose(MyPhoneNbr);

   StrDispose(MyAppName);

   StrDispose(MyCalledParty);

   StrDispose(MyComment);

 end;

end;