Just wondering if theres a function to get the window title of your browser.
Like if you were to visit www.myspace.com your window title would be: www.myspace.com - Mozilla Firefox
or w/e browser you happen to use.
Is there a way to get the title of a window?
Use GetWindowText() once you have the handle to the correct window.
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
Call EnumWindows () to get a list of all the top-level windows so that you can get the handle to the browser window. The problem is -- how will you know which one is the browser?
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
> The problem is -- how will you know which one is the browser?
Simple :) You can use Spy++ to find out the browsers class name and then you can narrow down which windows are browsers. I found out these:
Firefox's Class: MozillaUIWindowClass
IExplorer Class: IEFrame
Now usingAD's suggestion, using EnumWindows you can narrow it down only to the internet explorers.
Another helpful function you could try, FindWindow .
If you have firefox, test out this code and the title of the browser should change, if not simply change to class name to work with IExplorer.
#include<windows.h>
int main() {
HWND firefox = FindWindow("MozillaUIWindowClass", NULL);
SetWindowText(firefox, "Found it!!");
return 0;
}
but this only works with one browser, so your probably better to stick withAD's technique.
Hope this helps.
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395