Besides understanding the Catalog physical structure, you need to be familiar with how to interact with the three Catalog interfaces and object types (root, collection, and object). This section will walk you through a few programming examples and demonstrate most of what you need to know when programming the Catalog.
The starting point for everything you do
with the Catalog is the root object. You create the root object with
the class ID of
(or the prog-ID of
) and obtain an
interface pointer to the
interface. You use the
ICOMAdminCataloginterface pointer to either invoke root-level methods or
access one of the top-level collections by
method, defined as:
[id(1)] HRESULT GetCollection([in]BSTR bstrCollectionName, [out,retval]IDispatch** ppCatalogCollection);
You can use
ICOMAdminCatalog::GetCollection( ) to
access only the top-level collections (such as
Applications) shown in Figure 6-2. Accessing lower level collections is done
differently, and you will see how shortly.
GetCollection( ) returns an
to the specified collection. Once you get the collection you want,
you can release the root object. Example 6-1 shows
how to access the
collection by creating the root object and calling
Example 6-1. Accessing a top-level collection such as Applications
HRESULT hres ...