C#: How to find out IE's URL

  • Thread starter Thread starter BK
  • Start date Start date
B

BK

Hi all!

I am a total newbie on this stuff and I am probably asking for
an answer for very stupid (simple) problem.
Well..

I would like to write a C# application that checks URLs where
user go/surf by using IE. I found on the internet how to do that
by launching own instance of IE (new InternetExplorer()...) and then
with the help of events in shdocvw.dll I can see where the user is
surfing. This works fine.
But... I have a problem of detecting URLs of the browser that is not
started with my application. How can I find appropriate instance
of the browser and 'connect' to it so that I could know its URL.
I know that by using

System.Diagnostics.Process[] myProcesses =
System.Diagnostics.Process.GetProcesses();

and then traversing through names of the process and searching
for 'iexplore' I can find the process data about the already launched
IE. But what next??

How can I find out at which URL is that alread launched IE?

Please help... I need this quit urgently:(

Regards to all,
Branko

P.S.: Please respond to my e-mail too, because I have difficulties
using news:(
 
BK said:
But... I have a problem of detecting URLs of the browser that is not
started with my application. How can I find appropriate instance
of the browser and 'connect' to it so that I could know its URL.

See KB Article KB176792 "HOWTO: Connect to a Running Instance of
Internet Explorer"
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
 
You will need to use remoting. Im sorry I dont have to create the
example for you. But here is:

// something like this but you need to take care of remoting issues
// before you can do this.

// remembet that these processes are in different application domains.
ObjRef or = myprocess.CreateObjRef(typeof(AxAxBrowse.AxAxBrowser));



http://xpcoder.net
 
Hi!

I tried the resource from Igor and it worked fine.
For anybody else, in C# it was something like that:

--
ShellWindows SW = new ShellWindowsClass();
string Temp;

foreach (InternetExplorer TempIE in SW)
{
Temp = Path.GetFileNameWithoutExtension(TempIE.FullName).ToLower();
if (Temp.Equals("iexplore"))
{
....
}
}
--
I also had problems when I want to compare two browser instances. Using
method Equals from InternetExplorer was not working in all cases and
then I used comparing via property HWND which works ok.

Thanks!!!

Branko

Coder said:
You will need to use remoting. Im sorry I dont have to create the
example for you. But here is:

// something like this but you need to take care of remoting issues
// before you can do this.

// remembet that these processes are in different application domains.
ObjRef or = myprocess.CreateObjRef(typeof(AxAxBrowse.AxAxBrowser));



http://xpcoder.net





BK said:
Hi all!

I am a total newbie on this stuff and I am probably asking for
an answer for very stupid (simple) problem.
Well..

I would like to write a C# application that checks URLs where
user go/surf by using IE. I found on the internet how to do that
by launching own instance of IE (new InternetExplorer()...) and then
with the help of events in shdocvw.dll I can see where the user is
surfing. This works fine.
But... I have a problem of detecting URLs of the browser that is not
started with my application. How can I find appropriate instance
of the browser and 'connect' to it so that I could know its URL.
I know that by using

System.Diagnostics.Process[] myProcesses =
System.Diagnostics.Process.GetProcesses();

and then traversing through names of the process and searching
for 'iexplore' I can find the process data about the already launched
IE. But what next??

How can I find out at which URL is that alread launched IE?

Please help... I need this quit urgently:(

Regards to all,
Branko

P.S.: Please respond to my e-mail too, because I have difficulties
using news:(
 
Back
Top