C#,写windows mobile for smartphone,如何读到设备号?
设备号、手机号、sim卡序列号。这些要用API吗,请指点。
先奉上100分,不够还有5000多分。
问题点数:100、回复次数:7Top
1 楼phaqyxiao(非奇)回复于 2006-03-01 14:39:04 得分 0
上面我说的手机号是指手机电话号码Top
2 楼phaqyxiao(非奇)回复于 2006-03-06 13:28:08 得分 0
没人指点一下。Top
3 楼phaqyxiao(非奇)回复于 2006-03-13 15:06:21 得分 0
再顶。Top
4 楼flyingbat2(flying_bat)回复于 2006-03-16 16:14:51 得分 0
帮你顶Top
5 楼depascal(阿狼)回复于 2006-03-16 20:01:48 得分 0
在微软的在线msdn可以搜索到这方面的资料Top
6 楼newstarmoon(苍穹)回复于 2006-03-20 15:55:07 得分 0
查寻相关TAPITop
7 楼lbluekey(蓝鸟)回复于 2006-03-20 21:02:20 得分 0
private static Int32 FILE_DEVICE_HAL = 0x00000101;
private static Int32 FILE_ANY_ACCESS = 0x0;
private static Int32 METHOD_BUFFERED = 0x0;
private static Int32 IOCTL_HAL_GET_DEVICEID =
((FILE_DEVICE_HAL) << 16) | ((FILE_ANY_ACCESS) << 14)
| ((21) << 2) | (METHOD_BUFFERED);
[DllImport("coredll.dll")]
private static extern bool KernelIoControl(Int32 IoControlCode, IntPtr
InputBuffer, Int32 InputBufferSize, byte[] OutputBuffer, Int32
OutputBufferSize, ref Int32 BytesReturned);
private struct HKEY
{
//Int32 unused;
};
/*
*
*
#define HKEY_CLASSES_ROOT (( HKEY ) (ULONG_PTR)0x80000000 )
#define HKEY_CURRENT_USER (( HKEY ) (ULONG_PTR)0x80000001 )
#define HKEY_LOCAL_MACHINE (( HKEY ) (ULONG_PTR)0x80000002 )
#define HKEY_USERS (( HKEY ) (ULONG_PTR)0x80000003 )
* */
/*private static HKEY HKEY_CLASSES_ROOT = (HKEY)0x80000000;
private static HKEY HKEY_CURRENT_USER = (HKEY)0x80000001;
private static HKEY HKEY_LOCAL_MACHINE = (HKEY)0x80000002;
private static HKEY HKEY_USERS = (HKEY)0x80000003;
//LONG APIENTRY RegCloseKey ( IN HKEY hKey);
*
* 455 RegCloseKey
465 RegCopyFile
456 RegCreateKeyExW
457 RegDeleteKeyW
458 RegDeleteValueW
460 RegEnumKeyExW
459 RegEnumValueW
1152 RegFlushKey
461 RegOpenKeyExW
1542 RegOpenProcessKey
462 RegQueryInfoKeyW
463 RegQueryValueExW
1479 RegReplaceKey
466 RegRestoreFile
1478 RegSaveKey
464 RegSetValueExW
[DllImport("Coredll.dll" , EntryPoint="RegCloseKey")]
private static extern int RegCloseKey(ref HKEY hKey);
[DllImport("Coredll.dll" , EntryPoint="RegCreateKeyExW")]
private static extern int RegCreateKeyExW(ref HKEY hKey);*/
==============================
try
{
byte[] OutputBuffer = new byte[256];
Int32 OutputBufferSize, BytesReturned;
OutputBufferSize = OutputBuffer.Length;
BytesReturned = 0;
bool retVal = KernelIoControl(IOCTL_HAL_GET_DEVICEID,
IntPtr.Zero,
0,
OutputBuffer,
OutputBufferSize,
ref BytesReturned);
// If the request failed, exit the method now
if (retVal == false)
{
return null;
}
string strDeviceInfo="";
for (int i = 0; i<OutputBufferSize; i++)
{
//strNextChar.Format(TEXT("%02X"), OutputBuffer[i]);
strDeviceInfo += String.Format("{0:X2}",OutputBuffer[i]);
}
string strDeviceId =
strDeviceInfo.Substring(40,2) +
strDeviceInfo.Substring(45,9) +
strDeviceInfo.Substring(70,6);
return strDeviceId;
Top




