Returning a string from C++ dll to VB.net

  • Thread starter Thread starter Ellie
  • Start date Start date
E

Ellie

I'm having a lot of trouble with this one so any help would be appreciated.
The C++ dll is just using the standard libraries. I have no trouble getting
numeric values. thanks
 
Ellie said:
I'm having a lot of trouble with this one so any help would be
appreciated. The C++ dll is just using the standard libraries. I have no
trouble getting numeric values. thanks

You will need Marshal.PtrToStringAnsi. Google for code examples.
 
Ellie said:
I'm having a lot of trouble with this one so any help would be
appreciated. The C++ dll is just using the standard libraries.

Could you please show us the exact prototype of the C++ DLL function?
What do you exactly mean with "the C++ dll is just using the standard
libraries": does it mean that you are using std::wstring at DLL interface?

Instead, if you are using raw TCHAR pointers at DLL interface to return
strings, you could look at PInvoke of GetWindowText API:

http://www.pinvoke.net/default.aspx/user32/GetWindowText.html

(The key idea there is to use the StringBuilder class.)

HTH,
Giovanni
 
Back
Top