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
LVL 3
hagurAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.