Re: BSTR * or VARIANT with VT_BSTR|VT_BYREF

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Rossen Tzonev (rossenbg_at_hotmail.com)
Date: 10/21/04


Date: Fri, 22 Oct 2004 02:27:56 +0300

Well Igor,

Sorry for not finishing my words. Here is example:

if BSTR** worked, then this is valid ( get\put pointer to variable which
holds pointer to BSTR )

[ id(1), propget ] HRESULT SomeProperty( [ out ] BSTR ** _pVal );
[ id(1), propput ] HRESULT SomeProperty( [ in ] BSTR * _pVal );

Because BSTR** does not work then I had to change it to:

[ id(1), propget ] HRESULT SomeProperty( [ out ] VARIANT * _pVal );
[ id(1), propput ] HRESULT SomeProperty( [ in ] VARIANT _pVal );

>From my point of view ( when looked as [ out ] parameter ) "VARIANT *" with
VT_BSTR|VT_BYREF do the same job as "BSTR**" and produce the same output
meaning :)

The purpose to experiment with all this stuff was to try some C++ tactics :)
I reach the case "BSTR **" for [ out ] and BSTR* for [ in ] and I hit the
problem I described at the beginning of this thread. In the upper code I
wanted to hold pointer to data, not the data itself, into in-process COM
object which definetely is into the memory space of the client. Just some
C++ tactics as I said.

-- 
Rossen Tzonev
Sofia, Bulgaria
"Igor Tandetnik" <itandetnik@mvps.org> wrote in message 
news:uWrAmxutEHA.2800@tk2msftngp13.phx.gbl...
> "Rossen Tzonev" <rossenbg@hotmail.com> wrote in message
> news:OGY8BqutEHA.2800@tk2msftngp13.phx.gbl
>> I do not know what to say except that in MSDN I have read recently
>> that when "Invoke" is used to do some stuff at any level ( my code or
>> MS underlying one ) only Automation types of data are allowed. It is
>> forbidded to use another one, because of incorrect bahaviour. and
>> BSTR** is not Automation one :) VARIANT with VT_BSTR | VT_BYREF is
>> Autonation
>
> VARIANT with VT_BSTR | VT_BYREF holds a BSTR*, not a BSTR**, so where do 
> you see a contradiction?
> -- 
> With best wishes,
>    Igor Tandetnik
>
> "On two occasions, I have been asked [by members of Parliament], 'Pray, 
> Mr. Babbage, if you put into the machine wrong figures, will the right 
> answers come out?' I am not able to rightly apprehend the kind of 
> confusion of ideas that could provoke such a question." -- Charles Babbage
> 


Relevant Pages

  • RE: MIDL2039: interface does not conform to [oleautomation] attribute
    ... > compatible BSTR pointer. ... the IDL declaration produces the following warning: ... > component is that this one is passed as a pointer. ...
    (microsoft.public.win32.programmer.ole)
  • Re: Assigning a BSTR to a CString
    ... that NULL pointer. ... in fact it was a exception raised by the CString ... You said that you but the string into a database. ... They can happily work with a BSTR which is also ...
    (microsoft.public.vc.atl)
  • Re: Activex container corrupts control property
    ... infact there were a problem in a totally different part of the control. ... I made a very stupid mistake, assigning the pointer to pVal in the get_ ... I also was ingamned by the fact that it was the only BSTR ...
    (microsoft.public.vc.atl)
  • RE: MIDL2039: interface does not conform to [oleautomation] attrib
    ... Kevin, I'll keep the TCHAR suggestion in mind for the future, but I don't ... > to accept/return a pointer to a pointer to a OLECHAR pointer. ... >> compatible BSTR pointer. ...
    (microsoft.public.win32.programmer.ole)
  • Re: Events sink object
    ... I've mentioned that convention is okay, ... In real method is declared as STDMETHODIMP HandlerMethod(long lParam, BSTR ... Vadym Stetsyak "Igor Tandetnik" wrote in message ...
    (microsoft.public.vc.atl)