• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >vc/mfc > 如何将一个CFrameWnd框架放到activex中

如何将一个CFrameWnd框架放到activex中

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-06-04

佚名通过本文主要向大家介绍了cframewnd,cframewnd类,cframewnd create,vc cframewnd,框架结构等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 如何将一个CFrameWnd框架放到activex中
描述:

如何将一个CFrameWnd框架(带有一个CWndSplitter和两个CView继承的视图)放到activex中。我没有试过。


解决方案1:

Designing ActiveX Components with the MFC Document/View Model
Steve Zimmerman  
By exploiting MFC's poorly understood document/view model, you can give your ActiveX component many great features with relatively little effort.  
W hether you're an experienced Win32® guru or a junior Windows® wanna-be, you've got to love MFC. It removes the drudgery from Windows development by encapsulating many of the menial parts of an application without sacrificing speed. In addition, it provides a very powerful, but often misunderstood, program model called the document/view model. The basic idea behind the document/view architecture is to separate data from its visual representation-the object-oriented programming model. A side benefit of its implementation in MFC is a multitude of built-in features, including toolbars, status bars, and File Save/Open.
The MFC framework provides three base classes that perform a lot of the redundant work of a typical application-CFrameWnd, CDocument, and CView. You create derived classes from each of those classes and override the appropriate virtual functions to tailor your application to your needs. To glue the three objects together, you create a CSingleDocTemplate or CMultiDocTemplate object and presto, MFC makes the thing fly. To make it even easier, AppWizard automatically generates the files containing the skeletons of your CFrameWnd, CDocument, and CView-derived classes.
Although the document/view approach is not appropriate for every problem, Figure 1 shows what it adds to your application with little or no effort.
Document/View, Meet ActiveX 
You've probably been using MFC to write standalone apps for years. The real question is, how can you use the MFC document/view model to develop cool Web-based applications with active content? Not all of the features listed in Figure 1 are appropriate for an ActiveX™ control, but many of them are. If you want to do nothing more than separate an ActiveX control's data from its visual representation, using CDocument and CView-derived classes seems like a no-brainer. And if you could find a way to place a CFrameWnd-derived object inside an ActiveX control, you'd have quick and easy access to the added functionality provided by the CToolBar, CStatusBar, and CSplitterWnd classes.
The problem is that MFC does not provide a template class for jump-starting document/view inside an ActiveX control. In a standalone application, you simply create a CSingleDocTemplate or a CMultiDocTemplate, call it AddDocTemplate, and you're off to the races. But if you use these classes to create an ActiveX control, they create a parentless frame window with a menu bar and the WS_OVERLAPPED window style. Since you probably want to drop your ActiveX controls onto HTML pages and display them as child windows of your Web browser, neither of these template classes makes much sense.
To address this difficulty, I've developed two classes-CActiveXDocTemplate and CActiveXDocControl-that make it easy to take advantage of the document/view architecture inside an ActiveX control. In fact, I converted Scribble (the popular sample from the Visual C++® tutorials) into a document/view ActiveX control to show you how it works. You can download the full source code from the link at the top of this article. 
Let's start with a brief review of how the document/view architecture works. If you're already a document/view hotshot, feel free to skip over the next section.
Document/View 101: The Basics 
Since most of us at one time or another have worked through the scant but oh-so-informative MFC tutorials, let's use the trusty Scribble sample code as the basis for discussion. If you're new to MFC and want to follow along at home, you'll find step-by-step instructions for creating the Scribble sample in the Introducing Visual C++ manual that ships with Visual C++. 
In the Scribble sample, the CScribbleApp::InitInstance method contains the following code:  
 CMultiDocTemplate* pDocTemplate;
 pDocTemplate = new CMultiDocTemplate(
     IDR_SCRIBBTYPE,
     RUNTIME_CLASS(CScribbleDoc),
     RUNTIME_CLASS(CChildFrame),
     RUNTIME_CLASS(CScribbleView));
 AddDocTemplate(pDocTemplate);
 •••
 if (!ProcessShellCommand(cmdInfo))
     return FALSE;
 
The creation of a CMultiDocTemplate object 

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • vc6的Bug?vc7正常,在基于对话框程序里,创建出来的CFrameWnd会和对话框里的activex资源冲突
  • OCX下cframewnd做子窗口,怎样将CDocument与CView事件联系起来
  • 在ATL中能用MFC中的类吗?比如:CFileDialog,CFrameWnd等,如果可以怎么用,?
  • 如何将一个CFrameWnd框架放到activex中

相关文章

  • 2017-06-05 关于MFC中线程函数的问题,项目非常急,谢谢各位大虾!!!!!!!
  • 2017-06-05 DLL中的资源怎么添加???
  • 2017-06-04 VC调用office的问题,超级要我命,各位谁知道?给100分
  • 2017-06-04 为什么我在非模态框中显示ToolTips不行?
  • 2017-06-05 shockwaveocx造成界面卡死,无消息获取,何解?
  • 2017-06-05 如何获得三个线程的各自运行时间及总时间呢?
  • 2017-06-05 请教维护监控程序的问题
  • 2017-06-04 转换出的MP4无法同步到IPOD的问题?
  • 2017-06-04 ATL窗口字体设置
  • 2017-06-05 如何hookIE的单击事件

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • com组建调用IE控件异常的问题
    • 线程调用连接点函数
    • ××××在OCX控件中操作word并加入按钮的问题×××××
    • CComBSTR是线程安全的吗?
    • 关于icopyhook的问题
    • activexPropPage属性页OnInitDialog中给文本框赋不了值
    • 求救:串口收不到电机的反馈信息,但是可以成功发命令给电机
    • 怎样在VC里用ADO和ODBC接口写NTEXT类型字段?
    • 高手给点指教做这样的程序用单文档还是用mdi?用mfc还是用wtL?
    • 关于dll的问题

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有