CComObject back from CComPtr? -
05-08-2009
, 04:26 PM
Suppose I do the following in C++:
STDMETHODIMP CFoo::get_Bar (IBar **outBar)
{
CComObject<CBar> * bar;
CComObject<CBar>::CreateInstance(&bar);
bar->baz= myBaz;
CComPtr<IBar> iBar;
HRESULT hr = bar->QueryInterface(__uuidof(IBar),
reinterpret_cast<void**> (&ibar));
if(SUCCEEDED(hr)) iBar.CopyTo(outBar);
....
}
Now, I have some other function,
STDMETHODIMP CQux::set_Baz(IBar * inBar)
{
....
}
Within this function, I can't set myBaz = inBar->baz. It's not part
of the interface, and baz is of a type I don't think I can name in a
COM function signature (for reference, on the off off chance this
actually helps, it's from the Adobe Acrobat SDK 7.0.5. The type is
ASCab).
Can I create a CComObject instance with access to the baz belonging to
the IBar I'm passing in? Or is there some other way I can get at it?
Thanks,
Daniel Sheiner |