65.9K
CodeProject is changing. Read more.
Home

Pocket PC Phone Dialer

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.16/5 (17 votes)

Oct 4, 2006

CPOL

1 min read

viewsIcon

65352

downloadIcon

206

Pocket PC Phone Dialer

Introduction

This article explains how to make a phone dialler in eVC++ 4.0 MFC.

Making a Phone Call

All of the code you will see below are available for download. Making a call is a basic operation; we pass PhoneMakeCall, a string indicating the destination address and any options regarding whether or not we should ask for confirmation before placing the call.

ADD Header file

#include <phone.h>

In Editor, go to Project>Settings

Go to Link tab

Object/Library modules: phone.lib

Adding Library

Code in MFC

PHONEMAKECALLINFO mci;
LONG result;
memset(&mci, 0, sizeof(mci));
mci.cbSize = sizeof(mci);
mci.dwFlags = PMCF_DEFAULT ;
mci.pszDestAddress = TEXT("9810000000”)
result=PhoneMakeCall(&mci);
if (result != 0)
{
MessageBox(_T("Error"));
}

NOTE: Put desired number in place of 9810000000.

This structure contains the information required to make a phone call.

typedef struct tagPHONEMAKECALLINFO{
   DWORD cbSize;
   DWORD dwFlags;
   PCWSTR pszDestAddress;
   PCWSTR pszAppName;
   PCWSTR pszCalledParty;
   PCWSTR pszComment;
} PHONEMAKECALLINFO, * PHONEMAKECALLINFO;
Members

cbSize

The size of the PHONEMAKECALLINFO structure.

dwFlags

This member can contain either of the following values.

Value Meaning
PMCF_DEFAULT The user will not be prompted to confirm the phone call before the call is placed.
PMCF_PROMPTBEFORECALLING The user will be prompted to confirm the phone call before the call is placed.

pszDestAddress

A pointer to the phone number to be dialled. Validity of the specified address is not checked by this operation. The maximum length of the address is TAPIMAXDESTADDRESSSIZE characters, which includes the NULL terminator.

pszAppName

This parameter is reserved for future use; the value of this parameter must be set to NULL.

pszCalledParty

A pointer to the name of the party to be called. This pointer can be left NULL if the application does not wish to supply this information. The maximum length of the string is TAPIMAXCALLEDPARTYSIZE characters, which includes the NULL terminator. Longer strings are truncated.

pszComment

This parameter is reserved for future use; the value of this parameter must be set to NULL.

History

  • 4th October, 2006: Initial post