[問題] 使用dll的問題。
dll 的function 原型
使用dll viewer 看的
unsigned char HIDtoUARTDevice_SetOutputReport_Interrupt(unsigned char
*,unsigned long)
我在c# 中有使用DllImport,但是一直都無法成功。後來亂試看哪一種可以,
但都還是失敗。以下為我試過的,麻煩大家告訴我應該要怎麼改才對。
http://nopaste.csie.org/67493 <= 比較好看的程式碼
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char HIDtoUARTDevice_SetOutputReport_Control(ref byte[]
buffer, ulong length);
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char HIDtoUARTDevice_SetOutputReport_Control1(ref byte
buffer, ulong length);
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char HIDtoUARTDevice_SetOutputReport_Control2(byte[]
buffer, ulong length);
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char HIDtoUARTDevice_SetOutputReport_Control3(byte
buffer, ulong length);
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char HIDtoUARTDevice_SetOutputReport_Control4(string
buffer, ulong length);
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char
HIDtoUARTDevice_SetOutputReport_Control5([MarshalAs(UnmanagedType.LPWStr)]
string buffer, ulong length);
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char
HIDtoUARTDevice_SetOutputReport_Control6([MarshalAs(UnmanagedType.LPTStr)]
string buffer, ulong length);
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char
HIDtoUARTDevice_SetOutputReport_Control7([MarshalAs(UnmanagedType.LPArray)]
byte[] buffer, ulong length);
[DllImport("DLLCHID7.dll", CharSet = CharSet.Auto, CallingConvention =
CallingConvention.ThisCall, EntryPoint = "#15")]
public static extern char
HIDtoUARTDevice_SetOutputReport_Control8([MarshalAs(UnmanagedType.LPArray)]
string buffer, ulong length);
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.20.163.200
推
12/21 20:16, , 1F
12/21 20:16, 1F
→
12/21 21:06, , 2F
12/21 21:06, 2F