⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 WinCE VC++ 获取PDA的手机号
💻 CS
字号:
using System;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Data;
using OpenNETCF.Tapi;

namespace My_Phone_Number
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main(string[] args)
		{
			Tapi tapi = new Tapi();
			tapi.Initialize();
			Hashtable DeviceCaps;
			int deviceIDCell = -1;
			DeviceCaps = new Hashtable();
			for( int i = 0; i < tapi.NumDevices; i++ )
			{
				LINEDEVCAPS dc = new LINEDEVCAPS(1024);
				dc.Store();
				int dwVersion = tapi.NegotiateVersion(i);
				int ret = NativeTapi.lineGetDevCaps(tapi.hLineApp, i, dwVersion, 0, dc.Data);
				if ( ret < 0 )
					continue;
				if ( (LINEERR)ret == LINEERR.STRUCTURETOOSMALL )
				{
					dc.Data = new byte[dc.dwNeededSize];
					ret = NativeTapi.lineGetDevCaps(tapi.hLineApp, i, dwVersion, 0, dc.Data);
				}
				dc.Load();

				if (dc != null && dc.ProviderName == CellTSP.CELLTSP_PROVIDERINFO_STRING)
				{
					LINEADDRESSCAPS ac = new LINEADDRESSCAPS(1024);
					ac.Store();
					ret = NativeTapi.lineGetAddressCaps(tapi.hLineApp, i, 0, dwVersion, 0, ac.Data);
					ac.Load();
					string szPhoneNumber = Encoding.Unicode.GetString(ac.Data, ac.dwAddressOffset, ac.dwAddressSize);
					MessageBox.Show("My phone number is: " + szPhoneNumber);
					ac = null;
					deviceIDCell = i;
					break;
				}


			}


			if (deviceIDCell == -1) // Not found
				MessageBox.Show("Could not find cellular line");

			tapi.Shutdown();
		
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -