Click to See Complete Forum and Search --> : Title of the active window


Constantin K
April 3rd, 1999, 05:40 AM
Hello,
What is the best way to get the title (or any other info) about the current active window (It may not belong to my application). In other words I mean the window user working with.
As I understandd CWnd::GetActiveWindow works only with current Application

Best regards, Constantin Kuznetsov Jr.

Alek
April 3rd, 1999, 04:11 PM
This is the standard action to retrieve a caption of any Windows control.
char szTitle[80];
HWND hActiveWnd = GetActiveWindow();
hActiveWnd = GetWindowText(hActiveWnd, szTitle);
This is using Windows API but it is easy to find analogs in Visual C

ravish
May 3rd, 1999, 03:38 PM
If the application may not be urs, u can use GetForegroundWindow(). This will help i think