Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Firefox URL?

Tags:

c#

.net

firefox

How can I get the url from a running instance of firefox using .NET 2.0 windows/console app? C# or VB codes will do.

Thanks!

like image 503
Leon Tayson Avatar asked Jan 10 '09 05:01

Leon Tayson


1 Answers

Building on Rob Kennedy's answer and using NDde

using NDde.Client;

class Test
{
        public static string GetFirefoxURL()
        {
            DdeClient dde = new DdeClient("Firefox", "WWW_GetWindowInfo");
            dde.Connect();
            string url = dde.Request("URL", int.MaxValue);
            dde.Disconnect();
            return url;
        }
}

NB: This is very slow. It takes a few seconds on my computer. The result will look something like this :

"http://stackoverflow.com/questions/430614/get-firefox-url","Get Firefox URL? - Stack Overflow",""

More info on browser DDE here.

like image 141
Foole Avatar answered Sep 17 '22 23:09

Foole