passing COM object pointers to another COM object in ATL
I have a COM object having a member pointer variable pointing to a C++
object. I want to create another COM object with a method that accepts
the first COM object as a parameter.
I tried using VARIANT, but the pointer variable in the passed object
comes in as NULL (though, the pointers were initialized before being
It works fine if I use IUnknown* or IDispatch*; but then I am not able
to use the parameter as "optional" when calling from VB (it throws a
type mismatch if I dont pass an argument to an optional parameter of
type IUnknown* or IDispatch*).
Any ideas why this is happening? Any solutions?