Archive: Finding Windows Caption


Finding Windows Caption
I am trying to find the caption name of a Internet Explorer window, what is the best way of doing this?


If you have already window caption text, search for " - Microsoft Internet Explorer" substring in it using StrStr NSIS function.
To get window caption use GetWindowText() Win32 API call (via System plugin, user32.dll).
Script to get all IE window handles:

loop:
FindWindow $1 "" "IEFrame" 0 $1
IntCmp $1 0 done
# all u want to do with IE
goto loop
done:


Note: this will not work with ie4(if anyone uses that anymore), it uses another classname


There is another problem:

I've seen a few Programs changing the Caption of this Text
No, not the text before "- Microsoft Internet Explorer"
Yes the Text behind!

Some Program Complitations serve IE and other Progs with the Text "Internet Explorer X.X provided by ....."

So you should only search for Internet Explorer
this can be changed too, but it isn't done many times I think

Dave


You can change the IE title bar by editing a registry key:

HKCU\Software\Microsoft\Internet Explorer\Main\WindowTitle

I changed mine to remove "Microsoft Internet Explorer" so that method wouldn't work.


The main question is What b_avery@yahoo.c really wants to do? :)
And it's not easy to change IE 5-6 main frame class name, so NSIS script above should work. After this He can get IE window caption using window handle.


The registery Key is

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Window Title

And if blank then it is set to "Microsoft Internet Explorer"

This helps a lot as I can now search for my window caption :-)