Solved

MFC single document interface

Posted on 2009-04-07
4
435 Views
Last Modified: 2013-11-20
Hi Experts,

I created a single document interface - I'd like to create 2 different kinds of documents for it.  How do I set this up?

Thanks!
Mike
0
Comment
Question by:thready
  • 2
  • 2
4 Comments
 
LVL 30

Expert Comment

by:Zoppo
Comment Utility
Hi thready,

this is not quite easy since SDI really means Single Document Interface. The class responsable for handling documents, frame windows and views is CDocManager, which contains a list of CDocTemplate-derived classes. For SDI this is CSingleDocTemplate, for MDI CMultiDocTemplate. Unfortunateley you cannot use CMultiDocTemplate in a SDI application since a CMultiDocTemplate requires the use of one or more CMDIChildFrame-derived classes as frame windows. This is because GUI elements of the CMainFrame change depending on the active document frame's resources, i.e. menus, toolbars a.s.o.

One possibility would be to use a MDI application with two document templates using the same CMDIChildFrame- and CView-derived classes for two different CDocument-derived classes. I guess it should be possible two override CDocument::OnOpenDocument in a way it doesn't create a new frame and view but re-uses existing ones. And I think it should even be possible to modify the main and/or child frame class in a way the child frame always is maximized. If it's an option for you to use an MDI application like this please tell, then maybe I can give you further help how to do this (but not before tomorrow morning, sorry).

Another possibility is to use take a SDI application which implements two mainframes with two documents and synchronizes the main frames when documents are switched. You can find some sourcecode here: http://www.codeguru.com/cpp/w-d/doc_view/viewmanagement/article.php/c3255/

Hope that helps,

ZOPPO
0
 
LVL 1

Author Comment

by:thready
Comment Utility
Question for you Zoppo- I really need to change my view class (I just realized this)- it's not my document that I need to change.  Is it possible to select from different views for the current open document?
0
 
LVL 30

Accepted Solution

by:
Zoppo earned 500 total points
Comment Utility
0
 
LVL 1

Author Closing Comment

by:thready
Comment Utility
Thanks Zoppo
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now