Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing a String to a DLL
Message
De
26/04/2001 04:34:22
Duncan Jones
Merrion Computing Ltd
Dublin, Irlande
 
 
À
24/04/2001 15:20:07
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00499201
Message ID:
00500013
Vues:
15
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
Fil
Voir

Click here to load this message in the networking platform