gpt4 book ai didi

c# - 如何创建可以处理 URL :callto and URL:tel protocols in Windows 10? 的 WPF 应用程序

转载 作者:行者123 更新时间:2023-12-04 15:40:06 26 4
gpt4 key购买 nike

我的任务是创建一个 WPF 应用程序,当用户在浏览器(Chome,IE)中单击 callto: 和 tel: 链接时,打开它们的默认应用程序是我创建的 Windows 10 WPF 应用程序并处理它们。

我尝试通过编写脚本并手动输入 Visual Studio 输出的已发布 .exe 的路径来更改注册表,但这些都不起作用,每当我单击 callto: 或 tel: 链接时,打开的默认程序是仍然是 Skype 等 voip 应用程序。

我已经改了[HKEY_CLASSES_ROOT\tel\shell\open\command]Computer\HKEY_CLASSES_ROOT\callto\shell\open\command"C:\App\bin\Release\app.publish\App.exe" -c "call\%1" (这是我程序的 .exe)

我希望浏览器会提示打开应用程序。

最佳答案

你读了吗this page ,其中解释了如何注册为快捷方式的使用者。

To register an application to handle a particular URI scheme, add a new key, along with the appropriate subkeys and values, to HKEY_CLASSES_ROOT. The root key must match the URI scheme that is being added. For instance, to add an "alert:" scheme, add an alert key to HKEY_CLASSES_ROOT, as follows:


HKEY_CLASSES_ROOT
alert
URL Protocol = ""

Under this new key, the URL Protocol string value indicates that this key declares a custom pluggable protocol handler. Without this key, the handler application will not launch. The value should be an empty string.

Keys should also be added for DefaultIcon and shell. The Default string value of the DefaultIcon key must be the file name to use as an icon for this new URI scheme. The string takes the form "path, iconindex" with a maximum length of MAX_PATH. The name of the first key under the shell key should be an action verb, such as open. Under this key, a command key or a DDEEXEC key indicate how the handler should be invoked. The values under the command and DDEEXEC keys describe how to launch the application handling the new protocol.

Finally, the Default string value should contain the display name of the new URI scheme. The following example shows how to register an application, alert.exe in this case, to handle the alert scheme.


HKEY_CLASSES_ROOT
alert
(Default) = "URL:Alert Protocol"
URL Protocol = ""
DefaultIcon
(Default) = "alert.exe,1"
shell
open
command
(Default) = "C:\Program Files\Alert\alert.exe" "%1"

When a user clicks a link containing your custom URI scheme, Windows Internet Explorer launches the pluggable protocol handler registered for that URI scheme. If the specified open command specified in the registry contains a %1 parameter, Internet Explorer passes the URI to the registered pluggable protocol handler application.

关于c# - 如何创建可以处理 URL :callto and URL:tel protocols in Windows 10? 的 WPF 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58113126/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com