Solved

pseudo-MDI application

Posted on 1997-07-16
3
206 Views
Last Modified: 2013-11-20
I would like to have an application that consists of several
types of documents and views and the views can be seen
together and arranged with the automatic "cascade" and "tile" features you get with MDI.
The problem is, I do not want it to be MDI, i.e. only
one document of each type may exist.
How can I do that ?
0
Comment
Question by:mco
  • 2
3 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1302603
If you are thinking you cannot achieve blocking more than one instance of a view or a document then you should reconsider. There are ways where you can check if a particular document has already been opened by another view. This can be done on a file basis as well as on a C++ object basis. This can be also implemented for views.

Yes, this can be also done without using MDI and instead using SDI or a group of CWnd's (like VB 4.0 does) but this is not clean and often lands with heaps of extra code which would have already been written by MS for a MDI interface.

It is a decision you should make whether you can live with MDI and get the  problem you have sorted out or re-write some  code to get it working on a SDI or worst a dialog based application.

If u come up with more precise details about your problem I will be here to help you.
0
 
LVL 1

Author Comment

by:mco
ID: 1302604
Your answer was general. I was expecting something more specific.
Let me rephrase: I will start it off as an MDI (in order for
Visual C++ do all the work related to the "tile" and "cascade"
features).
How do I prevent another instance of a document (not a view)
to be created.
If you give specific sample code lines, I'll give you an A.

0
 
LVL 4

Accepted Solution

by:
mbhakta earned 100 total points
ID: 1302605
Here is an algorithm : - Start from the active view- Iterate through all the visible (opened) views in the MDI application. Use GetNextView().- Get the document pointer for the view pointer returned from the previous call. - Use IsKindOf() call to check whether the document belongs to a particular class. Keep the count in memory. - Go to the next view. Repeat the previous step. If the counter for that view is more than 1 , that's it you have found another instance of the same doc. Kill that view.Apply this procedure even when a new view is opened. This can go in the OnInitialUpdate() where the view checks for the counter (can be located in theApp). Perform the step 3 and 4 if found.
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
wait notify demo infinite loop 3 96
haveThree challenge 22 114
tripleUp challenge 7 74
Use of condition with 'serial' in ansible 2 49
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 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

13 Experts available now in Live!

Get 1:1 Help Now