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

x
?
Solved

pseudo-MDI application

Posted on 1997-07-16
3
Medium Priority
?
226 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
[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
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 300 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

Independent Software Vendors: 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

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…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

722 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