获取Firefox的网址是什么?网址、Firefox

2023-09-02 10:26:28 作者:爱自己么情敌

我怎样才能从Firefox的使用.NET 2.0的窗口/控制台应用程序的运行实例的网址是什么? C#或VB codeS就可以了。

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.

谢谢!

推荐答案

建立在罗伯肯尼迪的答案,并使用 NDDE

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",""

在浏览器DDE 更多信息。

More info on browser DDE here.