Click to See Complete Forum and Search --> : how to use bstr in C++


roboguru
January 6th, 2003, 09:41 AM
please assist how to use BSTR in C++.
this is what i what i want to do

struct _data
{
BSTR pName;
short Age;


};


And be able to use _data in both VB and C++

Yves M
January 11th, 2003, 12:03 AM
You can't really pass structs between C++ and VB. The best way for VB would be if you made your C++ object a COM object and provide get_ and put_ methods for the Name and Age properties of the object.

TheCPUWizard
January 11th, 2003, 12:16 AM
Yves, I have another suggestion, that has worked for myself and is easy to understand by most...


Create the code the way you want in VB. Put this code into a public objects of a COM DLL or OCX control. In VC create a class from the typelib.

Let the computer do the work!


Hope this helps...