View Full Version : DLL Hell Programming
sans-hubris
09-01-2002, 05:06 PM
I'm not really sure which section this should be in since it encompasses multiple languages (specifically C++ and VB6.0.)
I'm pretty sure that to convert between a VB String and a C++ string you use the MFC CString class. Is this correct?
How do you use a struct defined in C++ inside a VB application? Do you create a Collection?
stuka
09-09-2002, 02:42 PM
The datatype in C/C++ for the VB string is, I think, a BSTR (and there are conversion methods to/from a CString). As for structs, VB has a struct-like thing - syntax:Type typename
fieldname1 AS datatype
fieldname2 AS datatype
End Type
My guess is that you'd need this for a struct.
Oh..looked this up in MSDN:In general, use the ByVal keyword when passing string arguments to DLL procedures that expect LPSTR strings. If the DLL expects a pointer to an LPSTR string, pass the Visual Basic string by reference.
(Note that LPSTR is either a char* or wchar*, depending on platform, etc.)
yeah, BSTR is what VB strings are in C++, or _bstr_t .. kind of the same thing. MS sucks, they make life hell for C++ programmers trying to use VB shit. IMO.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.