O'Reilly logo

COM & .NET Component Services by Juval Lowy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Interacting with the Catalog

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 Catalog Root Object

The starting point for everything you do with the Catalog is the root object. You create the root object with the class ID of CLSID_COMAdminCatalog (or the prog-ID of COMAdmin.COMAdminCatalog ) and obtain an interface pointer to the ICOMAdminCatalog interface. You use the ICOMAdminCataloginterface pointer to either invoke root-level methods or access one of the top-level collections by calling the GetCollection( ) 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 ICatalogCollection pointer 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 Applications collection by creating the root object and calling ICOMAdminCatalog::GetCollection( ).

Example 6-1. Accessing a top-level collection such as Applications

HRESULT hres ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required