Hi
I'm trying to find the URL that is being viewed in an IE window, by using
the PID or the hWnd of the IE window.
Does anyone know how this could be done? or where I should be looking?
Thanks
Chris Taylor - 12 Mar 2006 19:51 GMT
Hi,
This will require interop to the windows API.
Once you have the hwnd of internet explorer you can use the EnumChildWindows
to locate the combobox, for IE 6 the class name is ComboBoxEx32 and the
control id is 0xA205. The caption of the control is the URL in the address
bar.
Hope this helps

Signature
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor
> Hi
> I'm trying to find the URL that is being viewed in an IE window, by using
[quoted text clipped - 3 lines]
>
> Thanks
Mattias Sjögren - 12 Mar 2006 23:15 GMT
>I'm trying to find the URL that is being viewed in an IE window, by using
>the PID or the hWnd of the IE window.
>
>Does anyone know how this could be done? or where I should be looking?
If you're only interested in IE it may be better to use the COM APIs
in Shdocvw.dll. If you Tlbimp it you can write code like this to dump
info on all IE (and Windows Explorer) windows.
foreach (InternetExplorer ie in new ShellWindows())
{
Console.WriteLine(ie.HWND);
Console.WriteLine(ie.LocationName);
Console.WriteLine(ie.LocationURL);
}
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.