[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Controlling modem, dialing etc ...

I've created a simple phonebook program, and now I want to be able to dial the selected phonenumber.

How can I let the modem dial the number?
I could maybe somehow use dial-up networking to access the modem and dial?
(Like Getright does)

-Hagur
0
hagur
Asked:
hagur
  • 3
  • 2
1 Solution
 
florisbCommented:
Hi Hagur,

First, before people get angry, when should I propose something as a comment and when as an answer?

the answer is tapiRequestMakeCall, included code from working example, I edited the variables, so check them...:-)

procedure TForm1.btnDialClick(Sender: TObject);
// Uses windows dialer (telephone API (TAPI));
// Floris.
var
  telNumber, AppName, CalledOrganizationName,Comment: array[0..255] of Char;
  TAPIReturn: Integer;
begin
//init vars / copy-pasted and edited from working code.

if edtTelephone.text = '' then
  Exit;
Comment := 'Calling blabla';
StrPCopy(telNumber, edtPrefix.Text+edtOrganizationTelephone.text);
StrPCopy(AppName, application.title); // or something?
StrPCopy(CalledOrganizationName, edtOrganizationName.text);

try
TAPIReturn := tapiRequestMakeCall(telNummer,AppName,CalledOrganizationName,Comment);
except
  TAPIReturn := -1;
end; {try}

if TAPIReturn <> 0 then
    MessageBox(Handle, PChar('No modem or line busy blabla'), PChar(cCaption), MB_OK OR MB_ICONERROR);
end;
0
 
florisbCommented:
Ahhh, add after:
{$R *.DFM}

This:
function tapiRequestMakeCall(DestAddress, AppName, CalledParty, Comment: PChar): LongInt; stdcall; external 'TAPI32.DLL';

Good Luck!
Floris.
0
 
hagurAuthor Commented:
I'm going to try this as soon as I can, and then I'll let you know.

Thanks!
0
 
hagurAuthor Commented:
I tried it, and yes, it works!

Thanks alot Florisb!
0
 
florisbCommented:
you're welcom,

C.U.

Floris.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now