Solved

MFC single document interface

Posted on 2009-04-07
4
438 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 31

Expert Comment

by:Zoppo
ID: 24091906
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
ID: 24092982
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 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 24094325
0
 
LVL 1

Author Closing Comment

by:thready
ID: 31567716
Thanks Zoppo
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 144
sum13 challenge 24 90
sum28 challenge 31 105
modThree challenge 4 77
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

919 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

19 Experts available now in Live!

Get 1:1 Help Now