控件引入引入FormView:
1、创建一新的MFC ActiveX ControlWizard项目,取名为Hello,其他用缺省选项;
2、在ResourceView页中新增一对话框资源,命名为IDD_HELLODIALOG,属性的Style页为Style:Child、Border:Dialog Frame、Title Bar:unchecked;设置More Style页为Visible:checked;Control:checked;设置Extended Styles页为Static Edge:checked;
3、为对话框资源IDD_HELLOFORMVIEW创建新类CHelloFormView,从CFormView继承;
4、在HelloFormView.h中将CHelloFormView的构造函数CHelloFormView()和析构函数virtual ~CHelloFormView()从protected改为public;
5、在HelloFormView.h中对CHelloFormView类加入public friend class CHelloCtrl;
6、确认在HelloCtrl.h中已加入语句#include "HelloFormView.h",为CHelloCtrl类添加成员变量CHelloFormView m_helloFormView;
7、修改CHelloCtrl::OnCreate函数,在此创建m_helloFormView;8、修改CHelloCtrl代码,在此显示FormView;
int CHelloCtrl::OnCreate
(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
// 创建FormView
m_helloFormView.Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL);return 0;
}void CHelloCtrl::OnDraw(CDC* pdc, const
CRect& rcBounds, const CRect& rcInvalid)
{
// 定位Hello对话框
m_helloFormView.MoveWindow(rcBounds,TRUE);
}编译成ocx控件后,嵌入网页,刷新和关闭时出现Debug Assertion Failed错误。
大家帮帮忙解决解决!!
1、创建一新的MFC ActiveX ControlWizard项目,取名为Hello,其他用缺省选项;
2、在ResourceView页中新增一对话框资源,命名为IDD_HELLODIALOG,属性的Style页为Style:Child、Border:Dialog Frame、Title Bar:unchecked;设置More Style页为Visible:checked;Control:checked;设置Extended Styles页为Static Edge:checked;
3、为对话框资源IDD_HELLOFORMVIEW创建新类CHelloFormView,从CFormView继承;
4、在HelloFormView.h中将CHelloFormView的构造函数CHelloFormView()和析构函数virtual ~CHelloFormView()从protected改为public;
5、在HelloFormView.h中对CHelloFormView类加入public friend class CHelloCtrl;
6、确认在HelloCtrl.h中已加入语句#include "HelloFormView.h",为CHelloCtrl类添加成员变量CHelloFormView m_helloFormView;
7、修改CHelloCtrl::OnCreate函数,在此创建m_helloFormView;8、修改CHelloCtrl代码,在此显示FormView;
int CHelloCtrl::OnCreate
(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
// 创建FormView
m_helloFormView.Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL);return 0;
}void CHelloCtrl::OnDraw(CDC* pdc, const
CRect& rcBounds, const CRect& rcInvalid)
{
// 定位Hello对话框
m_helloFormView.MoveWindow(rcBounds,TRUE);
}编译成ocx控件后,嵌入网页,刷新和关闭时出现Debug Assertion Failed错误。
大家帮帮忙解决解决!!
我的操作和她说的没有区别,怎么会出现错误呢?
我是个vc新手,可老板交给的任务必须完成,大家帮忙想想。
Debug Assertion Failed!!Program:iexplore.exe
file:wincore.cpp
line:879
这是什么原因?
想请问一下wodetian你的问题是怎么弄好的,按http://www.codeguru.com/activex/dialogctrl.shtml
上说的方法做出的ActiveX控件Insert到别的工程上也会报错,恳请指条路
想请问一下wodetian你的问题是怎么弄好的,我也遇到同样的问题