Re: Dual interface
"George" <George@discussions.microsoft.com> wrote in message
news:FEFF0209-1196-4186-BE0A-495538B03E74@microsoft.com
See e.g. STGMEDIUM structure. It contains IUnknown* pUnkForRelease
field. When specified, ReleaseStgMedium calls Release on this
pointer, and the object cleans up the structure. This mechanism can
be used when the default cleanup logic in ReleaseStgMedium is
unsuitable.
If a component only expose IUnknown interface, how could other
component utilizes its function?
In this particular example, the component's function is utilized by way
of the client calling IUnknown::Release on it.
I am not quite sure about the
speicific component described, but I doubt whether a component is
useful if it only exposes IUnknown.
What possible doubts could you still have in the face of a clear example
to the contrary?
Maybe in the specific component's
background and context, it is fine to expose only IUnknown and other
component could utilizes it? Could you give a little more background
of how other component will use it please?
I assume you have read the documentation on STGMEDIUM and found it
lacking. What specific shortcomings in it do you perceive?
I am confused about one simple concept of IUnknown when reading some
code and our discussion in this thread,
A. Every coclass component must implement IUnknown, but not a must
that every interface (which the coclass component implements) must
implement IUnknown;
Interfaces don't implement anything - objects do. Your statement is
meaningless.
B. Every interface of every coclass component must implement IUnknown.
Which one is correct?
Neither.
--
With best wishes,
Igor Tandetnik
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