无法在VC ++ 6.0中创建对象 - activex控件 [英] Failed to create object - activex control in VC++ 6.0

查看:90
本文介绍了无法在VC ++ 6.0中创建对象 - activex控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的方法正在执行两次,第一次为HRESULT值返回-2,147,467,262,第二次为零,为单个对象创建,最终无法创建ActiveX控件对象。



Below Method is being executed two times, first time returning -2,147,467,262 for HRESULT value and second time zero, for single Object creation, and ultimately fails to create ActiveX control object.

Value of HRESULT shows hresult = 

STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
      HRESULT hres = _Module.GetClassObject(rclsid, riid, ppv);
      return hres;
}





我的尝试:



负HRESULT值转换为0x80004002 / E_NOINTERFACE错误代码,描述为不支持此类接口。根据MSDN。



What I have tried:

negative HRESULT value translates to 0x80004002 / E_NOINTERFACE error code with description "No such interface supported." as per MSDN.

推荐答案

因此很明显对象创建出错了。当GUID不正确或对象未注册时,会发生这种情况。有时它发生在对象创建所需的某些(支持)dll丢失时。



检查调用参数是否正确对象。我的提示是它没有注册。在管理模式下使用regsvr32在命令行中注册!!!
So it is obvious that the object creation went wrong. This happens when the GUID isnt correct or the object isnt registered. Sometimes it happens when some (supporting) dll is missing which is needed for object creation.

Check that the correct object is adresssed by the call parameters. My tip is that it isnt registered. Register at the command line with regsvr32 in admin mode!!!


具有持久状态的ActiveX控件(此控件的情况)必须实现IPersistStream或IPersistStreamInit。添加一行COM_INTERFACE_ENTRY(IPersistStreamInit),



BEGIN_COM_MAP(MyControl)-------- END_COM_MAP()



解决了这个问题。
An ActiveX control that has persistent state, which was the case with this control, must implement either IPersistStream or IPersistStreamInit. Adding a line "COM_INTERFACE_ENTRY(IPersistStreamInit)", under

"BEGIN_COM_MAP(MyControl)-------- END_COM_MAP()"

solved the issue.


这篇关于无法在VC ++ 6.0中创建对象 - activex控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆