New to Porgramming, I have a project that requires a unique device identifier for each mobile device made in C #.
Windows Mobile 5.0 SDK R2
Here is the code I'm working with:
[DllImport("coredll.dll")] private extern static int GetDeviceUniqueID([In, Out] byte[] appdata, int cbApplictionData, int dwDeviceIDVersion, [In, Out] byte[] deviceIDOuput, out uint pcbDeviceIDOutput); public static string GetDeviceID() { string appString = "MyApplication"; 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; }
But when I try to deploy and run, I get: Cannot find the entry point GetDeviceUniqueID in the DLL "coredll.dll" PInvoke.
Can someone tell me what I'm doing wrong or not what I had in mind?
source share