ATL Object and BSTR out parameter...

Started by
0 comments, last by stu_pb 20 years, 7 months ago
The following ATL Object code block works when called from a VB Application that simply displays a message box with the returned data: STDMETHODIMP CSomeClass::get_SomeData(BSTR *pVal) { CComBSTR tmp; tmp += "h"; tmp += "i"; *pVal = tmp.Detach(); } The following code block does not work when called from the same VB application: STDMETHODIMP CSomeClass::get_SomeData(BSTR *pVal) { char Data[] = {"hXXXXi"}; CComBSTR tmp; tmp += Data[0]; tmp += Data[5]; *pVal = tmp.Detach(); } Can anyone help me out with how I can convert the char''s into the BSTR return val "hi". Thanks for the help! I should probably be working now...
I should probably be working now...
Advertisement
use

tmp.Append(Data[0]);
tmp.Append(Data[5]);

That should do it.

This topic is closed to new replies.

Advertisement