Passing COM objects as parameters to other COM objects
> Pass them as IUnknown and dynamically_cast them back to what they were...
Um. Don't dynamic cast. Use QueryInterface.
You can pass any interface pointer directly. You don't need to send IUnknown
only for C++. However, if you are using scripting, then IUnknown it is.
In C++, to pass an object into a function, use in idl
[in] IUnknown *p
as a function parameter. Do not call AddRef or Release on the pointer,
either in the calling function or the called, unless the parameter is being
saved for future reference. Then it is best to use a smart pointer class,
such as CComPtr<> to do it for you.
If you are not using scripting, you can replace IUnknown with the interface
of your choice so you don't have to bother QueryInterfacing into what you