Information générale
Catégorie:
Codage, syntaxe et commandes
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)
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement