View Full Version : C++ API BSTR* out parameters

12-02-2004, 11:20 AM

I have a C++ API (not COM) with a method that has a BSTR* out parameter:
HRESULT __stdcall GetSomeResults(BSTR pathName, BSTR* results);

Does any know how I get the 'results' value back into my InstallScript?

I've tried a variety of declarations of the call and other tricks from this community, eg SPrintf, and the like but nothing seems to get the string back correctly.

Please help!


Christopher Painter
12-03-2004, 10:55 PM
I'm not the biggest C++ geek in the world so this may not help. From what I've read on MSDN BSTR and unicode string arrays that can contain nulls and keep going.



From the second link it sounds like you need to create a pointer. Somehow the API allocates the memory for the pointer and you are only responsible for freeing it. Once you have the BSTR you have to use a variety of APIs to convert it to more useful datatypes.

Hope I'm close to correct there. I've never done BSTR's.

This looks helpful also: