控件引入引入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.   

    you can consult this article: it is such same to your said.
      

  2.   

    http://www.codeguru.com/activex/dialogctrl.shtml
      

  3.   

    kingzai(kingzai) :
    我的操作和她说的没有区别,怎么会出现错误呢?
      

  4.   

    you download its project and check the diffrence between your project and it.
      

  5.   

    把你com的套间设成multi的试试!
      

  6.   

    我想做的是嵌入word的ocx控件,其中,我给这个控件新加了一个COleDocObjectItem,一个视图类,文档类,一个frame类。我把frame显示载控件窗口上,然后,在视图中嵌入word,在网页上能够正确显示word,可是在打开控件时,或者进行word各种操作时,虽然能够执行,不过总出现Debug Assertion Failed断言错误。
    我是个vc新手,可老板交给的任务必须完成,大家帮忙想想。
      

  7.   

    出现的是:
    Debug Assertion Failed!!Program:iexplore.exe
    file:wincore.cpp
    line:879
    这是什么原因?
      

  8.   

    有没有打vs6.0的pack5补丁?试试看!
      

  9.   

    不是回答问题
    想请问一下wodetian你的问题是怎么弄好的,按http://www.codeguru.com/activex/dialogctrl.shtml
    上说的方法做出的ActiveX控件Insert到别的工程上也会报错,恳请指条路
      

  10.   

    不是回答问题
    想请问一下wodetian你的问题是怎么弄好的,我也遇到同样的问题