Eladla
asked on
Passing a string from VB.NET to C++ DLL
I need to pass a string from VB.NET to a C++ DLL.
My limitation is that I need to be able to manipulate the string in c++, I need all the functionalty I get from std::string.
I tryed casting to std::string without much luck.
I need the VB.NET type, C++ type and any other casts or code needed to use them.
Thanks!
My limitation is that I need to be able to manipulate the string in c++, I need all the functionalty I get from std::string.
I tryed casting to std::string without much luck.
I need the VB.NET type, C++ type and any other casts or code needed to use them.
Thanks!
ASKER
I have seen the flipcode site....not much help to me.
Thanks anyway.
Any other ideas?
Thanks anyway.
Any other ideas?
Alternatively have a look at this post which suggesting to use StringBuilder :
http://www.dotnet247.com/247reference/msgs/40/200377.aspx <====
-MAHESH
http://www.dotnet247.com/247reference/msgs/40/200377.aspx <====
-MAHESH
ASKER
I need something similar to the find function of std:string
or it`s useless to me.
I`ll check out your other link.
or it`s useless to me.
I`ll check out your other link.
ASKER
I checked out the StringBuilder...it would work, but since I`m using unmanaged code and would rather
stick to stdlib C++, I don`t want to import .net namespaces and such.
stick to stdlib C++, I don`t want to import .net namespaces and such.
ASKER
I have already found this:
http://groups.google.com/group/microsoft.public.vc.language/browse_thread/thread/c743b54624a1009c/cee84773330632aa?lnk=st&q=cast+BSTR+to+std%3A%3Astring&rnum=2&hl=en#cee84773330632aa
And it looks like it`s working. If anyone has better ideas, mainly ones that do not require
com or atl type references...please let me know.
http://groups.google.com/group/microsoft.public.vc.language/browse_thread/thread/c743b54624a1009c/cee84773330632aa?lnk=st&q=cast+BSTR+to+std%3A%3Astring&rnum=2&hl=en#cee84773330632aa
And it looks like it`s working. If anyone has better ideas, mainly ones that do not require
com or atl type references...please let me know.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Following may be helpful :
Handling VB strings (as part of an array of UDT)
http://www.codeguru.com/Cpp/W-P/dll/interfacingtovisualbasicapplications/article.php/c103/
Interfacing VB and C++
http://www.flipcode.com/articles/article_vbdlls.shtml
-MAHESH