Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Get Device's Phone Number

Windows Mobile 6.5

This code sample is named GetPhoneNumber. It demonstrates how to retrieve a mobile device's phone number.


The application entry point (message box containing phone number if available).


The precompiled type source file.


The precompiled header.

To run the code sample
  1. 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.5.3 DTK\Samples\Common\CPP\Win32\GetPhoneNumber

    Microsoft Visual Studio launches and loads the solution.

  2. Build the solution (Ctrl+Shift+B).

  3. Deploy the solution (F5).

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).

SDK: Windows Mobile Professional SDK and Windows Mobile Standard SDK

Development Environment: Visual Studio 2005 or 2008.

ActiveSync: Version 4.5.

Community Additions

© 2015 Microsoft