开发者

Convert simple MFC CView/CDocument/CSingleDocTemplate app to ActiveX control

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.

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?

Is it possible to use the COleControl sub-class in place of the CFrameWnd sub-class in the CSingl开发者_C百科eDocTemplate? Or do I need to place the CFrameWnd sub-class within the COleControl some how?

Failing that, how can I use my existing CDocument\CView sub-classes within an ActiveX control?


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. :(

Fortunately though, the Wayback Machine still has a complete copy of it:

"Designing ActiveX Components with the MFC Document/View Model" by Steve Zimmerman, Microsoft Interactive Developer (April 1997)

Steve presents source code for two new classes:

CActiveXDocTemplate : a sub-class of CSingleDocTemplate
CActiveXDocControl : a sub-class of COleControl

which allowed me to use my existing CView and CDocument sub-classes in an ActiveX control.

(Thanks Steve wherever you are now)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜