将简单的MFC CView / CDocument / CSingleDocTemplate应用程序转换为ActiveX控件 [英] Convert simple MFC CView/CDocument/CSingleDocTemplate app to ActiveX control
问题描述
我有一个相当简单的MFC应用程序,它只是定义自己的子类 CDocument
, CView
code> CFrameWnd 并通过 CSingleDocTemplate
使用它们在视图的树中显示文档的只读内容。所有非常标准的MFC MVC。
I have a fairly simple MFC app that just defines its own sub-classes of CDocument
, CView
and CFrameWnd
and uses them via a CSingleDocTemplate
to display the read-only contents of the document in a tree on the view. All very standard MFC MVC.
我现在需要转换这个应用程序,使其作为一个ActiveX控件,然后可以将其嵌入一个更大的应用程序。
I now need to convert this app so that it works as an ActiveX control that I can then embed it within a larger application.
我应该如何解决这个问题?
How should I go about this?
可以使用 COleControl
子类中的 CFrameWnd
子类代替 CSingleDocTemplate
或者我需要将 CFrameWnd
子类放在 COleControl
中吗?
Is it possible to use the COleControl
sub-class in place of the CFrameWnd
sub-class in the CSingleDocTemplate
? Or do I need to place the CFrameWnd
sub-class within the COleControl
some how?
如果不能,我如何在ActiveX控件中使用我现有的 CDocument\CView
子类?
Failing that, how can I use my existing CDocument\CView
sub-classes within an ActiveX control?
推荐答案
回答自己的问题:我发现了很多关于这个旧文章的引用, =http://www.microsoft.com/mind/0497/mfc.asp =nofollow> http://www.microsoft.com/mind/0497/mfc.asp 但有长因为消失了。 :(
Answering my own question: I found quite a few references to an old article about this, which used to be at http://www.microsoft.com/mind/0497/mfc.asp but has long since disappeared. :(
幸运的是, Wayback Machine 仍然有完整的副本:
Fortunately though, the Wayback Machine still has a complete copy of it:
使用MFC文档/视图模型设计ActiveX组件作者Steve Zimmerman,Microsoft Interactive Developer(1997年4月)
"Designing ActiveX Components with the MFC Document/View Model" by Steve Zimmerman, Microsoft Interactive Developer (April 1997)
Steve为两个新类提供源代码:
Steve presents source code for two new classes:
CActiveXDocTemplate
:的子类别
CSingleDocTemplate
CActiveXDocControl
: COleControl
,允许我使用我现有的 CView
和 CDocument
子类。
which allowed me to use my existing CView
and CDocument
sub-classes in an ActiveX control.
(感谢Steve,无论你身在何处)
(Thanks Steve wherever you are now)
这篇关于将简单的MFC CView / CDocument / CSingleDocTemplate应用程序转换为ActiveX控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!