By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

How do I use a char array in an API?

P: n/a
We have some C++ code that we need to convert to VB.net. It calls the DeviceIOControl API and uses a char array as the output buffer. We think we need to use marshalling to do this but don't know exactly how. For example if we use
Dim outputBuffer(1000) as char
anObject = DeviceIoControl(aHandle, FSCTL_ENUM_USN_DATA, EnumDataBufferIn, Marshal.SizeOf(EnumDataBufferIn), outputbuffer, Marshal.SizeOf(outputbuffer), byteBack, 0)

It tells us that outputbuffer cannot be marshalled as a meaningful structure, no meaningul size or offset can be computed. We have tried all kinds of things to try and get around this and get different errors with everything we try.
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

How did you declare DeviceIoControl? If the C++ code used a char
array, you should probably use a byte array in VB (.NET Char != C++
char). And the parameter type should therefore also be a Byte().

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.