我的网络浏览器应用程序如何从另一个应用程序获取打开的 URL

发布于 2024-12-05 02:43:01 字数 705 浏览 2 评论 0原文

我通过 Visual Studio.Net 2008 创建了一个“Windows 窗体应用程序”项目。

为了将我的应用程序设置为操作系统的默认 Web 浏览器,我修改注册表如下:

[HKEY_CLASSES_ROOT\HTTP\shell\open\command] @="\"F:\My Browser\bin\Debug\My Browser.exe\" -nohome"

然后我单击“Live Messenger”窗口中的链接进行测试。

http://2.bp.blogspot.com/_lktgSLsaLgU/R3di1ZNDyWI/AAAAAAAACWQ/u1xcH9W0g_I/s400/vicito-news.png

结果,它将打开我的应用程序。问题是,我找不到我在属于“Program”类的“Main”方法的“args”参数中单击的URL。

public static class Program
{
    [STAThread]
    static void Main(string[] args)
    {
    }
}

我在哪里可以找到网址?或者怎样才能找到网址?

I have created a "Windows Forms Application" project by Visual Studio.Net 2008.

In order to set my appliction as the default web browser for my operating system, I modify registry as below:

[HKEY_CLASSES_ROOT\HTTP\shell\open\command]
@="\"F:\My Browser\bin\Debug\My Browser.exe\" -nohome"

and then i click a link in a "Live Messenger" window to test.

http://2.bp.blogspot.com/_lktgSLsaLgU/R3di1ZNDyWI/AAAAAAAACWQ/u1xcH9W0g_I/s400/vicito-news.png

As a result, it will open my application. the problem is that, I can't find out the URL I clicked in the "args" argument of the "Main" method belong to the "Program" class.

public static class Program
{
    [STAThread]
    static void Main(string[] args)
    {
    }
}

Where I can find out the URL? Or how can I find out the URL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小猫一只 2024-12-12 02:43:02

您的注册表项应包含 %1 指令,该指令指示 shell 将 URL 参数传递到浏览器参数中。

因此,在您的情况下,正确的注册表是:

[HKEY_CLASSES_ROOT\HTTP\shell\open\command] @="\"F:\My Browser\bin\Debug\My Browser.exe\" "%1"

Your registry key should include the %1 directive that instructs the shell to pass the URL parameter into the browsers arguments.

So in your case the correct registry is:

[HKEY_CLASSES_ROOT\HTTP\shell\open\command] @="\"F:\My Browser\bin\Debug\My Browser.exe\" "%1"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文