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

x
?
Solved

How to get the name of Active Window

Posted on 2003-11-18
3
Medium Priority
?
668 Views
Last Modified: 2013-11-20
Hi All
How can we get the Name of the Active Frame In MDI application.

Mannu

0
Comment
Question by:manoj_sharma1911
[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
3 Comments
 
LVL 11

Expert Comment

by:KurtVon
ID: 9771295
It depends what you mean by "name".

CView* pView = ((CMainFrame*)AfxGetMainWnd())->GetActiveView()

gets the currently active view.  Now you can use that in several different ways:

// Get the title of the MDI child window
pView->GetParentFrame()->GetWindowText(strName);
// Get the file name
pView->GetDocument()->GetPathName();

Hope this helps.
0
 
LVL 1

Expert Comment

by:igor_sk
ID: 9771298
MDIGetActive() returns the currently active MDI child window:

CMDIChildWnd* MDIGetActive( BOOL* pbMaximized = NULL ) const;

CMDIChildWnd is derived from CFrameWnd, which is derived from CWnd. So, you can use CWnd::GetWindowText() method to get the name of this window.
0
 

Accepted Solution

by:
VirtualEye earned 150 total points
ID: 9771928
Simply, Use the method:

CWnd* GetActiveWindow();
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

704 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