Solved

MFC single document interface

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

9 Experts available now in Live!

Get 1:1 Help Now