Solved

How to get the name of Active Window

Posted on 2003-11-18
3
662 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 50 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

Suggested Solutions

Title # Comments Views Activity
modThree challenge 4 155
zeroMAx challenge 20 135
fix34  challenge 9 181
Change to event 1 138
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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

751 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