我有一个带有以下声明的.h文件:
//////////////////////////////////////////////////////////////////////////////// // Syntek Plug-In Custom Control GUIDs. // //////////////////////////////////////////////////////////////////////////////// // {59DF6360-6F14-4472-82B6-6EAB971EEFAD} DEFINE_GUID(CLSID_IStkCustomControl,0x59DF6360,0x6F14,0x4472,0x82,0xB6,0x6E,0xAB,0x97,0x1E,0xEF,0xAD); // {59DF6361-6F14-4472-82B6-6EAB971EEFAD} DEFINE_GUID(CLSID_IStkCustomControl_PropertyPage,0x59DF6361,0xAD); // Custom Control Interfaces. MIDL_INTERFACE("59DF6360-6F14-4472-82B6-6EAB971EEFAD") IStkCustomControl : public IUnkNown { public: virtual HRESULT STDMETHODCALLTYPE Get(PKSPROPERTY_STK_CUSTOM_CONTROL_S pStkCustomControl) = 0; virtual HRESULT STDMETHODCALLTYPE Set(PKSPROPERTY_STK_CUSTOM_CONTROL_S pStkCustomControl) = 0; };
我想将接口IStkCustomControl移植到C#.到目前为止,我有这个C#代码:
Guid guid = new Guid(0x59df6360,0x6f14,0xb6,0x6e,0xab,0x1e,0xef,0xad); Type type = Type.GetTypeFromCLSID(guid); // line 2 object obj = Activator.CreateInstance(type);
执行第2行时,我得到了异常
Creating an instance of the COM component with CLSID
{59DF6360-6F14-4472-82B6-6EAB971EEFAD} from the IClassFactory Failed
due to the following error: 80040202.
这里出了什么问题?
更新:我发现IStkCustomControl接口是在一个名为StkProp.ax的文件中实现的.我试过运行AxImp.exe StkProp.ax,但这给了我
AxImp Error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。