2

Porgrammingは初めてですが、C#で実行される、モバイルデバイスごとに一意のデバイスIDを必要とするプロジェクトがあります。

Windows Mobile 5.0 SDK R2

これが私が扱っているコードピースです:

    [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;


    }   

しかし、デプロイして実行しようとすると、次のようになります。PInvokeDLLの「coredll.dll」にエントリポイント「GetDeviceUniqueID」が見つかりません。

誰かが私が間違っていること、または私が意図したことをしていないことを教えてもらえますか?

4

0 に答える 0