English 中文(简体)
窗口电话中的监听器号码 7 [复制]
原标题:Getting IMEI number in windows phone 7 [duplicate]
This question already has answers here:
Closed 11 years ago.

Possible Duplicate:
Find IMEI no in wp7?

是否在窗户电话7中安装了“监听器”号码的复印机,所有用户都可以通过使用“电听器”获得“特殊剂量”,但需要获得“监听器”。

问题回答

cc:http://www.cnblogs.com/xjb/archive/2007/02/05/640360.html

我没有测试以下代码。

public struct GeneralInfo
{
    public string Manufacturer;
    public string Model;
    public string Revision;
    public string SerialNumber;
    public string SubscriberNumber;
}

/// <summary>
/// Tapi control class
/// </summary>
public class ControlTapi
{

    [DllImport("cellcore.dll")]
    private static extern int lineGetGeneralInfo(IntPtr hLigne,byte[]lpLineGeneralInfo );

    /// <summary>
    /// Invoke cellcore.dll to get info of sim
    /// </summary>
    /// <param name="l"></param>
    /// <returns></returns>
    private  GeneralInfo GetGeneralInfo(Line l)
    {
        GeneralInfo lgi = new GeneralInfo();
        byte[] buffer = new byte[512];
        BitConverter.GetBytes(512).CopyTo(buffer, 0);

        if (lineGetGeneralInfo(l.hLine, buffer) != 0)
        {
            throw new System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error(), "TAPI Error: " + System.Runtime.InteropServices.Marshal.GetLastWin32Error().ToString("X"));
        }

        int subscsize = BitConverter.ToInt32(buffer, 44);
        int subscoffset = BitConverter.ToInt32(buffer, 48);
        lgi.SubscriberNumber = System.Text.Encoding.Unicode.GetString(buffer, subscoffset, subscsize).ToString();
        lgi.SubscriberNumber = lgi.SubscriberNumber.Replace("", "");
        return lgi;

    }



    /// <summary>
    /// GET IMSI of SIM Card
    /// </summary>
    /// <returns></returns>
    public static string  GetIMSINumber()
    {
        string result = "";
        try
        {
            Tapi t = new Tapi();
            t.Initialize();
            Line l = t.CreateLine(0, LINEMEDIAMODE.INTERACTIVEVOICE, OpenNETCF.Tapi.LINECALLPRIVILEGE.MONITOR);
            ControlTapi ctapi = new ControlTapi();
            GeneralInfo gi = ctapi.GetGeneralInfo(l);

            result =  gi.SubscriberNumber;
            l.Dispose();
            t.Shutdown();

        }
        catch// (Exception ex)
        {
            result = "";
        }

        return result;

    }

    /// <summary>
    /// Get IMEI
    /// </summary>
    /// <returns></returns>
    public static string GetIMEINumber()
    {
        string result = "";
        try
        {
            Tapi t = new Tapi();
            t.Initialize();
            Line l = t.CreateLine(0, LINEMEDIAMODE.INTERACTIVEVOICE, OpenNETCF.Tapi.LINECALLPRIVILEGE.MONITOR);
            ControlTapi ctapi = new ControlTapi();
            GeneralInfo gi = ctapi.GetGeneralInfo(l);
            result = gi.SerialNumber;
            l.Dispose();
            t.Shutdown();

        }
        catch// (Exception ex)
        {
            result = "";
        }

        return result;
    }

}




相关问题
System.Json namespace missing from Windows Phone 7

During a Mix10 presentation, the presenter (Charlie Kindel) said that when writing Silverlight based apps for WP7 you get all of Silverlight 3.0 with some of Silverlight 4.0 mixed in. Why then is ...

Will Windows Phone 7 Support Multitasking third party apps

Obviously it s early days, I do not know whether this is information that is in the public domain or not yet, but... I have trawled through some of this site - http://www.windowsphone7series.com/ but ...

Windows Series Phone 7 "Cloud"

I have been reading up on "Cloud computing" on here and still not getting it. Basically I want to develop for the WP7 http://msdn.microsoft.com/en-us/library/ff402531%28v=VS.92%29.aspx#...

Windows Phone 7 Tab Pages (page cycle)

I know.. I know, it s only a few hours old. But how the hell do you get the little page tabbing/cycle (forgot what the official name is) on the top of the page under the app title. MIX Keynotes made ...

Recording audio from the microphone in Windows Phone 7 Series

I m wondering if anyone has any code samples or links to documentation that demonstrate how to capture audio from the device s microphone on the new Windows Phone Series 7. I ve recently downloaded ...

Resources for Windows Phone 7 development [closed]

Windows Phone 7 has been unveiled and MS have announced all details of the development chain at the Mix10 conference. So this could be a good starting point/collection of online resources as they ...

热门标签