windows - 为什么 Windows 将包含协议(protocol)的完整自定义 URL 传递给处理应用程序?

标签 windows registry protocols

我正在尝试创建自己的 URL 协议(protocol),以从我们内部 CRM 中的 URL 启动自定义应用程序。

我已经创建了以下注册表项:

REGEDIT4

[HKEY_CLASSES_ROOT\smon1]
@="URL:smon Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\smon1\shell]

[HKEY_CLASSES_ROOT\smon1\shell\open]

[HKEY_CLASSES_ROOT\smon1\shell\open\command]
@="\"C:\\smon.exe\" \"%1\"" 

我的网站上有以下链接:

<a href='smon:1955'>1955</a>

我希望这会将变量 1955 传递给应用程序 c:\smon.exe。 然而它传递了整个变量“smon:1955”。

为什么它传递所有内容而不是变量?

我在这里缺少什么?

最佳答案

你没有错过任何东西,这就是处理程序的工作方式;整个 URI 在命令行中传递。检测并解析它。

其基本原理大概是它允许多个协议(protocol)与同一可执行文件关联,而无需在命令键中提供自定义的区分开关。

关于windows - 为什么 Windows 将包含协议(protocol)的完整自定义 URL 传递给处理应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31967196/

相关文章:

windows - 'Go' Windows 端口构建问题 : 8l linker crashes

Windows 服务安装文件夹.Net

c++ - 什么是 Win32 API (MFC) 等同于 .NET 中的 SystemInformation.CaptionHeight?

python - 如何修复 Python 3.x 中 input() 函数中的 NameError?

registry - HKEY_LOCAL_MACHINE\SOFTWARE\Classes 与 HKEY_CLASSES_ROOT

php - 注册表 Php 示例

c++ - 训练 sapi : Creating transcripted wav files and adding file paths to registry

Swift:枚举协议(protocol)不起作用

objective-c - MacRuby:遵守协议(protocol)

ios - Swift 协议(protocol) Where Constraint with == vs :