Re: IUnknown interface
"George" <George@discussions.microsoft.com> wrote in message
If your component implements a lot of COM
interfaces, each of these interfaces could implement its IUnknown
part in a different way
I am currently always using ATL to generate the underlying
implementation. But I am confused about what do you mean each
IUnknwon should be implemented in a different way?
Look up the difference between "should" and "could" in your favorite
English grammar textbook. Stuart said precisely the opposite.
The COM standard has some rules to ensure that you can identify
a COM object uniquely (by asking QueryInterface for IUnknown
Uniquely you mean when we query for a specific interface using
QueryInterface, always get the same result, even we query for IUnknown
interface, we always get the same one/address?
Only when you explicitly query for IUnknown are you guaranteed to get
the same address. This allows one to test whether two different
interface pointers actually refer to the same COM object.
Querying for any interface other than IUnknown is allowed to return a
different pointer every time. This is why you can't, in general, just
compare two interface pointers for equality to test whether they refer
to the same object.
With best wishes,
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925