Get Device's Phone Number
8/28/2008
This code sample is named GetPhoneNumber. It demonstrates how to retrieve a mobile device's phone number.
Feature Area
Relevant APIs
- lineGetAddressCaps function
- lineGetDevCaps function
- lineInitializeEx function
- lineNegotiateAPIVersion function
- Telephony API
Source File Listing
- getphonenumber.cpp
The application entry point (message box containing phone number if available).
- stdafx.cpp
The precompiled type source file.
- stdafx.h
The precompiled header.
Usage
To run the code sample
Navigate to the solution file (*.sln), and double-click it. By default, the solution files are copied to the following folders:
C:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\GetPhoneNumber
Microsoft Visual Studio 2005 launches and loads the solution.
Build the solution (Ctrl+Shift+B).
Deploy the solution (F5).
Remarks
For this sample, it is assumed that the mobile device uses a SIM with the device's phone number programmed into it. Some devices do not store their phone number on a SIM. For these devices, there is no way to programmatically determine the device's phone number and this sample will not successfully return the number.
This application does not need to run Privileged (i.e., it does not need to be signed with a certificate from the privileged store).
Development Environments
SDK: Windows Mobile 6 Professional SDK and Windows Mobile 6 Standard SDK
Development Environment: Visual Studio 2005.
ActiveSync: Version 4.5.