Re: Reading Data From The Browser by Jeff
Jeff
Thu Apr 24 12:22:26 CDT 2008
On 24/04/2008 in message
<d07c8ec5-89cb-45de-a6cc-4b204924553c@27g2000hsf.googlegroups.com>
emarvets@gmail.com wrote:
>I haven't touched the IE API's in years, but know there has to be a
>way. I doubt very seriously that FireFox does, but if anyone has any
>ideas, it is more than appreciated.
I use this to get the current URL in IE7:
public static string GetIEURL()
{
string strClassName = "IEFrame";
int intResult;
IntPtr ipChild;
IntPtr ipWindow = JDll.FindWindow(strClassName, IntPtr.Zero);
StringBuilder lpString = new StringBuilder(260);
if (ipWindow != IntPtr.Zero)
{
ipChild = JDll.FindWindowEx(ipWindow, IntPtr.Zero, "WorkerW",
IntPtr.Zero);
if (ipChild != IntPtr.Zero)
{
ipChild = JDll.FindWindowEx(ipChild, IntPtr.Zero, "ReBarWindow32",
IntPtr.Zero);
if (ipChild != IntPtr.Zero)
{
ipChild = JDll.FindWindowEx(ipChild, IntPtr.Zero, "Address Band
Root", IntPtr.Zero);//ComboBoxEx32
if (ipChild != IntPtr.Zero)
{
ipChild = JDll.FindWindowEx(ipChild, IntPtr.Zero, "ComboBoxEx32",
IntPtr.Zero);
if (ipChild != IntPtr.Zero)
{
intResult = JDll.SendMessage(ipChild, (int)WM.WM_GETTEXT, 260,
lpString);
}
}
}
}
}
return lpString.ToString();
}
If you want to keep it updated perhaps use a timer in your app?
You'll need to add some dll prototypes and constant definitions.
--
Jeff Gaines