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

Re: Finding the URL being viewed in IE from a PID or hWnd by Chris

Chris
Sun Mar 12 22:35:03 CST 2006

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

--
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor


"Paul Aspinall" <paul@aspy.co.uk> wrote in message
news:vSUQf.154327$YJ4.124798@fe2.news.blueyonder.co.uk...
> 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
>
>



Re: Finding the URL being viewed in IE from a PID or hWnd by Mattias

Mattias
Sun Mar 12 16:15:40 CST 2006

>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

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