从 URI 中启动应用程序 - VB.NET

3

我尝试为我的应用程序创建一个协议来启动游戏,但是我似乎无法通过URI实际启动它。 我正在尝试使用的协议是roblox://,但如果我输入它,它似乎无法启动该应用程序,Windows告诉我找不到启动URL的应用。

我使用的代码是:

If (My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator)) Then
    Dim newRegKey As RegistryKey
    newRegKey = Registry.ClassesRoot.CreateSubKey("RobloxProtocol", RegistryKeyPermissionCheck.ReadWriteSubTree)
    newRegKey.SetValue("", "URL:roblox")
    newRegKey.SetValue("URL Protocol", "")
    Dim newRegCom As RegistryKey
    newRegCom = newRegKey.CreateSubKey("shell\open\command")
    newRegCom.SetValue("", """" & Application.ExecutablePath & """" & " -id " & """" & "%1" & """")

    warnText.Text = "ROBLOX Protocol Launcher is installed!"
Else
    warnText.Text = "Please run ROBLOX Protocol Launcher as Administrator to finish the install process."
End If

如果我使用 regedit 查看注册表,键是存在的(我注册的是这篇文章中的那些键),但似乎并没有启动。我尝试过重新启动计算机,但仍然无法启动。

1个回答

3
在你提到的文章中,HKCR下子键的名称是alert,启动的url是alert://...
请将你的子键更改为roblox,而不是RobloxProtocol(或尝试从robloxprotocol://启动)。

@celliott1997:没问题。 - Jon Egerton

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接