IntroductionThis 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 Implementation1.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. |