I\'m trying to extract the URL from the address bar of IE. (IE 8 on Windows 7) using the following C# code.
static string GetUrlFromIE()
{
GetWindowText()
can't retrieve the text of a control in another process, instead you should use SendMessage()
with WM_GETTEXTLENGTH
/ WM_GETTEXT
.
Edit; Version agnostic way:
(Add a ref to c:\WINDOWS\system32\shdocvw.dll)
using SHDocVw;
.
.
foreach (InternetExplorer ieInst in new ShellWindowsClass())
Console.WriteLine(ieInst.LocationURL);