在摩托罗拉MC55中,我想要获得扫描仪的工厂或唯一id或序列号。如何在vb.net中编码?
发布于 2011-09-20 17:30:55
因为它是一种移动设备,所以它将有一个IMEI编号,那么这又如何?您可以使用ATD*#06#或AT++CGSN检索它。
发布于 2016-09-08 15:46:18
您可以使用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#解决方案的人来说,这对你来说应该是有效的。
https://stackoverflow.com/questions/7482745
复制相似问题