在摩托罗拉MC55中,我想获得扫描仪的工厂或唯一ID或序列号。如何在vb.net中编码?
答案 0 :(得分:0)
由于它是一个移动设备,它将有IMEI个数字,那么怎么样?您可以使用ATD*#06#
或AT++CGSN
进行检索。
答案 1 :(得分:0)
你可以P / Invoke来获取设备的DeviceUniqueID
//DeviceID for Win Mobile >= 5.0
[DllImport("coredll.dll")]
private extern static int GetDeviceUniqueID([In, Out] byte[] appdata, int cbApplictionData, int dwDeviceIDVersion,
[In, Out] byte[] deviceIDOuput, out uint pcbDeviceIDOutput);
private static string getDeviceID()
{
string appString = "Your App Name";
byte[] appData = new byte[appString.Length];
for (int count = 0; count < appString.Length; count++)
{
appData[count] = (byte)appString[count];
}
int appDataSize = appData.Length;
byte[] DeviceOutput = new byte[20];
uint SizeOut = 20;
GetDeviceUniqueID(appData, appDataSize, 1, DeviceOutput, out SizeOut);
string idString = "";
for (int i = 0; i < DeviceOutput.Length; i++)
{
if (i == 4 || i == 6 || i == 8 || i == 10)
idString = String.Format("{0}-{1}", idString, DeviceOutput[i].ToString("x2"));
else
idString = String.Format("{0}{1}", idString, DeviceOutput[i].ToString("x2"));
}
return idString;
}
编辑:注意这是一个C#解决方案抱歉,起初我没有看到你想要VB解决方案,但对于任何想要C#解决方案的人来说,这应该适合你。