Solved

switching between MDI child windows of different views

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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