do not forget to add refrence to SHDocVw .
Yaniv
private void btnConnExisting_Click(object sender, EventArgs e)
{
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass();
foreach (SHDocVw.InternetExplorer ie in shellWindows)
{
if (ie.LocationURL.Contains("what ever"))
{
MessageBox.Show("Location:" + ie.LocationURL);
ie.BeforeNavigate2 += new SHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler(this.ie_BeforeNavigate2);
}
}
}
public void ie_BeforeNavigate2(object pDisp, ref object url, ref object Flags,
ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel)
{
MessageBox.Show("do what you want!");
}
}