Vb.net 获取自定义 Uri 协议参数并解析

Vb.net Get Custom Uri Protocol Parameters & Parse

我在 Whosebug 上进行了很多搜索,也进行了 google 搜索,但没有找到任何可行的解决方案,顺便说一句,我是个新手。 我有一个 windows 基于表单的应用程序。我可以通过自定义 Url 协议 myapp:// 通过设置注册表项来启动它:

My App > shell > command > pathtomyfile/app.exe

我添加了一个超链接来启动应用程序,即

myapp://test123

它启动 app.exe 就好了。现在我如何接收 test123 作为参数。

所以我的问题是:

如何在应用程序中接收 test123 作为参数?

试试这个代码:

For Each argument As String In My.Application.CommandLineArgs
    ... (Add code here to use the argument) 
Next

您可以在 Form1.Load 或 Form1.Shown 事件中使用它。