Solved

switching between MDI child windows of different views

Posted on 1997-05-27
4
429 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
  • 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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unix / Linux grid computing 5 157
ffmpeg - "rtsp://...... Operation not permitted" 4 81
Problem to open Excel file 15 134
Message not shown 5 50
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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

810 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