How to phone number in windows mobile device using C#

Posted By  RRaveen On 26 Feb 2010 05:02:03
emailbookmarkadd commentsprint
No of Views:1441
Bookmarked:0 times
Votes:0 times

Introduction

This Tips help to you read the Phone number from SIM in windows mobile device. most of the Windows mobile device have support retrive SIM detail using Native code.Before read phone number form SIM, we have to  access Operating System function to .NET Compact framework using P/Invoke. 

Steps by Steps Implementation

1.Create SMS Address Structure

public struct SMS_ADDRESS
    {public const Int32 SMS_MAX_ADDRESS_LENGTH = 256;public enum SMS_ADDRESS_TYPE
        {
           
            SMSAT_UNKNOWN = 0,
           
            SMSAT_INTERNATIONAL,
           
            SMSAT_NATIONAL,
           
            SMSAT_NETWORKSPECIFIC,
           
            SMSAT_SUBSCRIBER,
           
            SMSAT_ALPHANUMERIC,
           
            SMSAT_ABBREVIATED
           
        }public static Int32 SmsGetPhoneNumber(ref SMS_ADDRESS psmsaAddress)
        {
           
        }public SMS_ADDRESS_TYPE smsatAddressType;public string ptsAddress;
       
    }
 

2.Now we have to create small windows Application with .NET Compact Framework, call above structure like below. 

private void Form1_Load(System.Object sender, System.EventArgs e)
    {            
        SMS_ADDRESS phone = new SMS_ADDRESS();         
        Int32 result = SMS_ADDRESS.SmsGetPhoneNumber(phone); 
    }

when form load you can get read phone from SIM, then you can display as messge box whatever you like it.That's all i hope this small tips will save your time.

Sign Up to vote for this article
Other popular Tips/Tricks
    Comments
    By:TaxerDate Of Posted:6/16/2011 10:57:14 AM
    Excellent Article
    Hi, This is a great article to learn about basic idea crystal report and ASP.NET Combination.Keep it up and publish more that is very help as like these resources.
    Leave a Reply
    Title:
    Display Name:
    Email:
    (not display in page for the security purphase)
    Website:
    Message:
    Please refresh your screen using Ctrl+F5
    If you can't read this number refresh your screen
    Please input the anti-spam code that you can read in the image.
    ^ Scroll to Top