Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MFC single document interface

Posted on 2009-04-07
4
Medium Priority
?
456 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 24094325
0
 
LVL 1

Author Closing Comment

by:thready
ID: 31567716
Thanks Zoppo
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

721 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