IClassFactory->CreateInstance aggregation check: "The CreateInstance method of IClassFactory takes pUnkOuter as the second member. This parameter must be null unless the class supports aggregation, which many don't."
Where can I find out which classes support aggregation?
On Tue, 30 Nov 2004 18:36:37 -0500, James Hawkins wrote:
IClassFactory->CreateInstance aggregation check: "The CreateInstance method of IClassFactory takes pUnkOuter as the second member. This parameter must be null unless the class supports aggregation, which many don't."
Where can I find out which classes support aggregation?
Typically MSDN will tell you. However MSDN is often wrong or missing vital info, so we need unit tests for them really.
Rob has made a start on a COM testing framework. Where COM objects are implemented, there should be unit tests which check if the object can be aggregated or not. For this a dummy COM object could be used and then passed as the outer unknown, if you don't get back CO_E_NOAGGREGATION then it's OK (in theory ... in practice I suspect not all objects check this).
Maybe we should have a header that makes aggregation checks really easy.
James Hawkins wrote:
IClassFactory->CreateInstance aggregation check: "The CreateInstance method of IClassFactory takes pUnkOuter as the second member. This parameter must be null unless the class supports aggregation, which many don't."
Where can I find out which classes support aggregation?
Generally, most classes don't bother with aggregation as it is only something that OLE geeks get excited over. There are a few classes in ole32 that support aggregation and it is specified as so in MSDN. So, unless tests or MSDN say otherwise, just assume that a class doesn't support aggregation.
Rob