你在“默认程序”网页上是正确的轨迹 - 实际上,这是我发布此文章的参考。
以下是他们的示例改编:
首先,您需要在 HKLM\SOFTWARE\Classes
中拥有一个 ProgID
,用于指定如何处理输入(您可能已经拥有它):
HKLM\SOFTWARE\Classes
MyApp.ProtocolHandler //this is the ProgID, subkeys are its properties
(Default) = My Protocol //name of any type passed to this
DefaultIcon
(Default) = %ProgramFiles%\MyApp\MyApp.exe, 0 //for example
shell
open
command
(Default) = %ProgramFiles%\MyApp\MyApp.exe %1 //for example
然后在 Capabilities
键内填写 DefaultProgram 信息到注册表中:
HKLM\SOFTWARE\MyApp
Capabilities
ApplicationDescription
URLAssociations
myprotocol = MyApp.ProtocolHandler //Associated with your ProgID
最后,使用DefaultPrograms注册您的应用程序功能:
HKLM\SOFTWARE
RegisteredApplications
MyApplication = HKLM\SOFTWARE\MyApp\Capabilities
现在所有 "myprotocol:" 链接都应该触发 %ProgramFiles%\MyApp\MyApp.exe %1
。
[HKEY_CLASSES_ROOT\myprotocol] (Default)="URL:myprotocol" "URL Protocol"=""
- Daniel"program files\foo.exe" "%1"
。 - slf