作者puper (Oh Yes)
看板C_Sharp
标题[问题] 使用dll的问题。
时间Tue Dec 21 18:30:34 2010
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
1F:推 horngsh:EntryPoint似乎不对 12/21 20:16
2F:→ puper:EntryPoint 有确认过,是没错的。 12/21 21:06