Solved

switching between MDI child windows of different views

Posted on 1997-05-27
4
440 Views
Last Modified: 2013-11-20
How can I programmatically switch between two open child windows (of different views) in a MDI application from CMainApp, the same way as it is done by selecting a window via the menu? (i.e. the corresponding window comes to the top, becomes active and has focus, etc...)

A kind of BringWindowToTop or SetWindowPos should make it, but it doesn't seem to work on MDI childs...

My documents and views are initialized in InitInstance as follows:

      CMultiDocTemplate* pDocTemplate1;
      pDocTemplate1 = new CMultiDocTemplate(
            IDR_TYPE1,
            RUNTIME_CLASS(CDoc1),            // document 1
            RUNTIME_CLASS(CChildFrame),       // custom MDI child frame
            RUNTIME_CLASS(CView1));            // view 1
      AddDocTemplate(pDocTemplate1);

      CMultiDocTemplate* pDocTemplate2;
      pDocTemplate2 = new CMultiDocTemplate(
            IDR_TYPE2,
            RUNTIME_CLASS(CDoc2),            // document 2
            RUNTIME_CLASS(CChildFrame),       // custom MDI child frame
            RUNTIME_CLASS(CView2));            // view 2
      AddDocTemplate(pDocTemplate2);

0
Comment
Question by:Sherpa
[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
4 Comments
 
LVL 1

Expert Comment

by:MarkusLoibl
ID: 1301824
Do you really need 2 Doc-Templates?
I think, dynamically switching different views having the same document) is not a problem!
0
 
LVL 4

Accepted Solution

by:
AVaulin earned 70 total points
ID: 1301825
Use ((CMDIFrameWnd*)AfxGetMainWnd())->MDINext().
0
 

Author Comment

by:Sherpa
ID: 1301826
Sorry, my fault :-)
I didn't explain my problem good enough...
I don't want to switch just to the next view, but to a (known) definite one among possibly many other open ones.
And I don't want to make a loop through all my open views to find the one I want to bring to top.

0
 

Author Comment

by:Sherpa
ID: 1301827
To MarkusLoibl:
Yes, unfortunately I really need to have two document templates...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

627 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