?? class1.cs
字號(hào):
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();
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -