Chapter Summary

 < Free Open Study > 



As you have seen in this chapter, the ATL framework is focused on creating an "as generic as possible" implementation of COM objects. The CComObjectRootEx<> template is used to equip your coclass with the appropriate level of threading support based on your configuration of the ATL Object Wizard. Objects living in the STA will make use of CComSingleThreadModel, whereas objects designed to live in the MTA will make use of CComMultiThreadModel. As the public interface of each is identical, you may swap between these classes to create thread-safe or thread-oblivious COM classes.

ATL objects support a table driven approach to QueryInterface(). The COM map resolves to an array of _ATL_INTMAP_ENTRY structures, each of which contains the information needed to return a vPtr to the client. The most common entry in the map is the COM_INTERFACE_ENTRY macro, which is considered a "simple" entry in that the vPtr is calculated using the coclass itself. Other ATL COM map macros determine the vPtr by accessing helper functions provided by base class templates.

Finally, this chapter has shown you a generic manner in which COM objects can report language-independent and location-transparent exceptions. To do so requires working with three standard COM interfaces, and three COM library functions, all of which are hidden from view when using the set of ATL Error() methods.



 < Free Open Study > 



Developer's Workshop to COM and ATL 3.0
Developers Workshop to COM and ATL 3.0
ISBN: 1556227043
EAN: 2147483647
Year: 2000
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net