Developers Workshop to COM and ATL 3.0

 < Free Open Study > 


Objectives:

We have already seen how COM object "A" can contain a single COM object "B" (just have the outer object call CoCreateInstance() on the inner object). However, we have not examined how a given object can contain a collection of objects, which may be obtained by the client in a standard fashion. COM provides a mythical interface named IEnumXXXX that allows a client a fixed way to "pull" a batch of items from a coclass, rather than asking for an item one at a time. This pattern is termed COM enumeration, and in this chapter we will examine how to build such an object container.

We then investigate a COM collection, which is (in essence) a language-neutral variation on the COM enumeration pattern. We also examine some of the templates provided by the ATL framework to help build COM enumerators and collections, and see how COM clients can manipulate their contents.


 < Free Open Study > 

Категории