General information
Category:
Coding, syntax & commands
You may have fallen foul of a Visual basic cludge fix.
In VB4(32) and beyond strings are held internally as OLE (BSTR) style strings. Most DLLs are written in C or C++ and there require their strings in the NULL terminated C style. Visual Basic handles the conversion for you behind the scenes in before calling the DLL however the way id decides which style of string you are passing is by use of the ByVal keyword. (This is very counter-intuitive).
So - if your DLL requires a C style string declare it ByVal in the Declare statement, if it requires a BSTR style string declare it ByRef.
(This is explained better in "The Visual Basic programmer's guide to the Win32 API" by Daniel Appleman)
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only