What's the reason behind the pUnkOuter
pa开发者_JAVA技巧rameter of IClassFactory::CreateInstance method?
HRESULT CreateInstance(
[in] IUnknown *pUnkOuter,
[in] REFIID riid,
[out] void **ppvObject
);
The MSDN's description of pUnkOuter
parameter notes:
If the object is being created as part of an aggregate, specify a pointer to the controlling IUnknown interface of the aggregate. Otherwise, this parameter must be NULL.
Can you good people please enlighten me on what is this parameter for?
See Aggregation in COM fundamentals. If you create an instance of COM object which is a part of an aggregate, you have to supply so called "outer IUnknown", which is owner COM object interface.
精彩评论