Article ID: 173823 - Last Review: June 29, 2004 - Revision: 3.1 How To Aggregate a COM Object with ATLThis article was previously published under Q173823 Note Microsoft Visual C++ .NET (2002) supports both the managed code
model that is provided by the Microsoft .NET Framework and the unmanaged native
Microsoft Windows code model. The information in this article applies only to
unmanaged Visual C++ code. On This PageSUMMARY The following steps demonstrate how to aggregate a COM
object in an ATL project:
MORE INFORMATION If you use and release an interface from the aggregate
during FinalConstruct, you should add the DECLARE_PROTECT_FINAL_CONSTRUCT macro
to the definition of your class object. Here is a sample with all four of the steps done in the class definition. This is a simple object, COutObj, which aggregates another simple object, CInnObj. Sample CodeREFERENCES Visual C++ Books Online: Visual C++ Books; C/C++ Language
and C++ Library; Active Template Library; Articles; Introduction to COM and
ATL; Introduction to COM; Aggregation Visual C++ Books Online: Visual C++ Books; C/C++ Language and C++ Library; Active Template Library; Articles; Fundamentals of ATL COM Objects; Creating an Aggregate APPLIES TO
| Article Translations
|
Back to the top
