On Wed, 2003-07-23 at 12:11, Ove Kaaven wrote:
ons, 23.07.2003 kl. 12.02 skrev Mike Hearn:
Hi, more questions (i'll master COM yet :)
HRESULT IWebBrowser2::get_Document(IDispatch **ppDisp);
Hmm. I assume this is an argument marked [out].
I don't have the IDL unfortunately, but I think that must be correct. It's access via IDispatch as a property at any rate.
OLE Automation isn't going to provide a ppDisp. When it's [out], it's the IWebBrowser2 object implementation (not OLE Automation) that's supposed to write a valid interface pointer (or maybe NULL) to *ppDisp, after which the typelib marshaller will marshal the interface back to the caller. (And of course, when it's [in], it's the caller that's supposed to provide a valid interface pointer.)
Yes, I see now, that makes sense.
If the IWebBrowser2 method that's invoked doesn't return an interface, it's either a bug in the IWebBrowser2 implementation, it failed for some reason, or perhaps the wrong method was invoked. Or something, I don't know the exact situation you have.
This comment in the code concerns me:
/*FIXME: give pointers for the rest, so propertyget works*/
well, this is indeed a property get, so the result should be made available in pVarResult.
This code looked promising:
/* If pointer to variant, pass reference it. */ if ((tdesc->vt == VT_PTR) && (tdesc->u.lptdesc->vt == VT_VARIANT) && pVarResult) { args[argspos] = (DWORD)pVarResult; }
so I copied it for the VT_DISPATCH case, but no cigar, it crashes later on in the marshalling code (in VariantClear). Am I at least on the right track? It seems not everything for property gets is implemented yet.
thanks -mike (i owe you about a million beers already :)