PHP调用MFC ActiveX控件接口时产生致命错误原因分析
来源:互联网 发布:夏夏的淘宝店铺 编辑:程序博客网 时间:2024/06/05 12:02
在调用控件接口时出现如下错误信息:
Uncaught exception 'com_exception' with message 'Error [0x8000ffff] Catastrophic failure。
然而直接MFC对话框上调用没有问题。
原因如下:
SUMMARY
In situations where an OLE container doesn't support control containment, you may want to use an OLE control as an automation server to gain access to its properties and methods. This article explains the necessary modifications you need to make in order for an OLE control to function as a normal automation server.
MORE INFORMATION
Prior to Visual C++ 4.0, an OLE Control could be used as an automation server without any modification. However, in MFC 4.0, the framework's implementation of IDispatch::Invoke calls the virtual function IsInvokeAllowed to determine if an automation server is in the appropriate state to handle automation calls. The default implementation in CCmdTarget::IsInvokeAllowed returns TRUE, implying that a server can handle automation calls.
In the case of an OLE control, COleControl::IsInvokeAllowed checks to see if the control has been either initialized or loaded properly through the persistent storage interfaces. If the control has the appropriate state information, then this function returns TRUE. When an OLE control is created as a normal automation server, it is not created as an embedding in the client. Hence, none of the persistent state initialization will take place, which thereby causes IsInvokeAllowed to return FALSE. The effect of this is that a call to an automation object method generates a run-time error of (8000ffff) : "Catastrophic failure".
In order to use an OLE control only as an automation server, you need to override COleControl::IsInvokeAllowed() and return TRUE. If any of the control's properties and methods should not be accessed when invoked as a normal automation server, then that automation function could be bypassed and/or an error code can be returned when COleControl::m_bInitialized is FALSE.
所以直接重写下COleControl::IsInvokeAllowed()就可以解决问题.
- PHP调用MFC ActiveX控件接口时产生致命错误原因分析
- vs2010开发activex(MFC)控件/ie插件(三),js调用ocx控件的接口函数
- ActiveX控件窗口的产生---源码分析
- MFC ActiveX OCX控件添加安全接口
- 使用VS2010开发ActiveX(MFC)控件(3)——添加接口及WEB调用
- 使用VS2010开发ActiveX(MFC)控件(3)——添加接口及WEB调用
- 使用VS2010开发ActiveX(MFC)控件(3)——添加接口及WEB调用
- 使用VS2010开发ActiveX(MFC)控件(3)——添加接口及WEB调用
- ActiveX(MFC)控件——添加接口及WEB调用
- 使用VS2010开发ActiveX(MFC)控件(3)——添加接口及WEB调用
- 使用MFC创建并调用ActiveX控件
- 使用MFC创建并调用ActiveX控件
- vs2008 外部调用ActiveX控件接口方法
- vs2008 外部调用ActiveX控件接口方法
- C# 代码中调用ActiveX控件更新接口造成编译错误的问题
- javascript与MFC ActiveX控件接口方法数据交换
- MFC Activex OCX接口
- [转载]使用MFC创建并调用ActiveX控件
- SQL 按月查询
- 自学日语
- 魔兽显血
- 绞车提升能力及钢丝绳验算软件验算结果如下
- Gallery概述
- PHP调用MFC ActiveX控件接口时产生致命错误原因分析
- 数组下标的本质
- Display Tag 的使用(转)
- ul中设置里元素右对齐的方法
- 蜗居的经典台词
- 善用系统监视器,确定系统瓶颈
- div 显示与隐藏
- JavaScript的内置对象和浏览器对象
- Ubuntu 9.10安装ibus拼音输入法