Solved

pseudo-MDI application

Posted on 1997-07-16
3
210 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 136
Expand data scrubbing tool 13 32
method notes when mouse over in eclipse 5 87
fix34  challenge 9 119
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: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

777 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