理解COM编程中的“种类”(Category)概念
2006-07-21 11:42:52 来源:WEB开发网对于注册种类编程的实例请参见VC知识库的另外一篇文章:“编写可复用性更强的MFC代码”。
讲了那么多有关注册的问题。现在假设你写了一个容器并且你想要产生一个插件(Acme Plugins)清单——既实现CATID_AcmePlugin的组件。Windoews提供了另一个接口,ICatInformation:
//
ICatInformation
class ICatInformation : public IUnknown {
public:
// Enumerate all categories
virtual HRESULT EnumCategories(
LCID lcid,
IEnumCATEGORYINFO ** ppenumCategoryInfo);
// Get locale-specific category descriptor
virtual HRESULT GetCategoryDesc(
REFCATID rcatid,
LCID lcid,
LPWSTR *pszDesc);
// Enumerate classes that implement/require given categories
virtual HRESULT EnumClassesOfCategories(
ULONG cImplemented,
CATID rgcatidImpl[],
ULONG cRequired,
CATID rgcatidReq[],
IEnumGUID **ppenumClsid);
// Determine if class implements/requires given categories
virtual HRESULT IsClassOfCategories(
REFCLSID rclsid,
ULONG cImplemented,
CATID rgcatidImpl[ ],
ULONG cRequired,
CATID rgcatidReq[ ]);
// Enumerate categories implemented by given class
virtual HRESULT EnumImplCategoriesOfClass(
REFCLSID rclsid,
IEnumGUID **ppenumCatid);
// Enumerate categories required by given class
virtual HRESULT EnumReqCategoriesOfClass(
REFCLSID rclsid,
IEnumGUID **ppenumCatid);
};
//
更多精彩
赞助商链接