Solved

How to get the name of Active Window

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 157
Shell script to login to remote m/c and execute commands 10 78
changeXy challenge 13 68
"Black Box" Testing of Control System Software 2 26
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

867 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

16 Experts available now in Live!

Get 1:1 Help Now