I’ve been working on a problem for over a week, so I may be blind, frustrated or just plain nuts. Please forgive me, but….
My class has this member:
IDevicePtr devicePtr
a function wants (IDevicePtr * ptr) as a parameter.
I can’t pass devicePtr to it, natural reasons:
cannot convert parameter 2 from 'IDevicePtr' to 'IDevicePtr *
BUT…
i also can’t pass &devicePtr to it:
compiler screams: cannot convert parameter 2 from 'IDevice **' to 'IDevicePtr *'
Where did “Idevice**” come from? How can I satisfy the “IDevicePtr *” function parameter requirements when I have an IDevicePtr object?
Sorry for the frustration. I’ve spent the last week trying to intercept one COM event without using ATL or MFC. No success. I haven’t been able to locate a living person who ever did something like that.
_COM_SMARTPTR_TYPEDEFdefines a pointer wrapper class – you can think of it as basicallytypedef IDevice *IDevicePtr, except that yourIDevicePtrauto-releases and auto-references.You should not be passing
IDevicePtr *s around. Pass aroundIDevice *and wrap it in aIDevicePtronly if you take a reference, or pass aIDevice **if you want to return-by-reference (you can take the address of anIDevicePtrto get anIDevice **). Do not attempt to use aIDevicePtr *for return-by-reference; this will fail (this is the problem you are seeing) because of thatoperator&overload.