看板 C_Sharp 關於我們 聯絡資訊
DWORD WINAPI RFID_ProgramTags (HANDLE b, unsigned char *pTagID, unsigned char a, unsigned char c, unsigned char d, unsigned char e); 這是在C++那邊所宣告的型態 我這C# 這邊宣告 [DllImport("RFIDAPI32PC.dll")] unsafe public static extern uint RFID_ProgramTags (IntPtr hReader, byte* pTagID, byte a, byte c, byte d, byte e); 我是這樣宣告的 然後我在使用的時候 是這樣用的 byte ptagID[]={1,2,3,4,5,6,7,8}; byte a,c,d,e; Intptr hReader; unsafe { fixed(byte* a=ptagID) RFID_ProgramTags(hReader, p, a,c, d, e); } 我在C# 是這樣使用的~~~其他的參數因該都沒問題!因為別的函數我都使用過 就這個函數多了個這種unsigned char *pTagID 這種型態 實在不知道怎麼丟 compile 會過~~但是結果都不對.... 我有c++的範例~範例那邊是這樣用的 unsigned char *pTagID; unsigned char a=8,b=3,c=3,d=3; pTagID = "\x01\x02\x03\x04\x05\x06\x07\x08"; RFID_ProgramTags(hRFIDReader, pTagID, a, b, c, d); 以上是在C++上所使用的範例 我想要在C#使用....不知道哪邊有錯! 請各位大大幫幫我吧...感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.168.81
horngsh:http://pinvoke.net 01/26 14:05