Hi to all. I'm trying to use hidapi.dll,if needed i'll post a sources or link to authors page. Here's what i've have in my dll: #define HID_API_EXPORT __declspec(dllexport) #define HID_API_CALL ... int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length); ... and this is the part in c#: [DllImport("hidapi.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, SetLastError = true)] public static extern unsafe int hid_write(IntPtr device, StringBuilder data, uint length); [DllImport("hidapi.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] public static extern unsafe int hid_get_serial_number_string(IntPtr dev, StringBuilder stringt, uint maxlen); ... Byte[] buf = new Byte[256]; buf[0] = 0x3F; buf[1] = …

Member Avatar
Member Avatar
+0 forum 5

Greetings! I have a win32 native dll (perhaps that's not the correct term - it's basically a C compiled dll) that I'm accessing in C#. The method signature of the C code (not the actual signature in the dll): [code=C++] char* TestMethod() [/code] I'd like to access the [B]char*[/B] as a [B]byte[][/B] in C#. I know how to access the [B]char*[/B] as a string in C#: [code] [DllImport("DLLTest.dll")] public static extern String ImportedTestMethod(); [/code] The main reason I want to do this is because the [B]char*[/B] output is encoded in UTF-8. If I get the actual bytes in C# then …

Member Avatar
Member Avatar
+0 forum 3

Hi there, I'm trying to access a resource only dll (compiled with the [i]/NOENTRY[/i] linker option) within C#. The dll file was created using a rc file that contains a [b]STRINGTABLE[/b]. I used [b]CComBSTR[/b] to load the string resource from the dll in C++; I'm not sure how to do the same in C#. Any suggestions would be appreciated :)

Member Avatar
Member Avatar
+0 forum 1

The End.