1. 文件包含:
#include <certenroll.h>
2. 接口定义:
interface IX509MachineEnrollmentFactory : public IDispatch
{
public:
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateObject(
/* [in] */ BSTR strProgID,
/* [retval][out] */ IUnknown **ppValue) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateObjectFromProgID(
/* [in] */ BSTR strProgID,
/* [retval][out] */ IUnknown **ppValue) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateObjectFromType(
/* [in] */ const IID *pType,
/* [retval][out] */ IUnknown **ppValue) = 0;
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CertificateTemplates(
/* [retval][out] */ ICertTemplateCatalog **ppValue) = 0;
};
3. 使用示例:
// 创建对象
CComPtr<IX509MachineEnrollmentFactory> pMachineEnrollmentFactory;
HRESULT hr = CoCreateInstance(
__uuidof(CX509MachineEnrollmentFactory),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IX509MachineEnrollmentFactory),
(void**)&pMachineEnrollmentFactory);
if (SUCCEEDED(hr))
{
// 使用工厂创建对象
CComPtr<IUnknown> pObject;
hr = pMachineEnrollmentFactory->CreateObject(L"X509Enrollment.CX509EnrollmentWebClassFactory", &pObject);
// 在这里可以使用创建的对象进行操作
}
请注意,上述代码中的 CX509MachineEnrollmentFactory 类是 IX509MachineEnrollmentFactory 接口的默认实现之一。在实际使用时,你可能需要根据你的需求使用工厂创建不同的对象。确保在使用这些接口时参考相关的官方文档和示例代码。
转载请注明出处:http://www.zyzy.cn/article/detail/24238/Win32 API/Certenroll.h/IX509MachineEnrollmentFactory