在Windows 8中以编程方式设置mailto:协议处理程序 [英] Setting mailto: protocol handler programmatically in Windows 8

查看:107
本文介绍了在Windows 8中以编程方式设置mailto:协议处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 8之前,添加mailto:协议处理程序的方法很简单(如此处

Before Windows 8, the method of adding a mailto: protocol handler was straightforward (as outlined here Register Windows program with the mailto protocol programmatically)

从Windows 8开始,旧方法不再起作用.看来Win8会强制执行以下键:HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\URLAssociations\‌​MAILTO\UserChoice.

As of Windows 8, the old method no longer works. It would seem that Win8 enforces the following key: HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\URLAssociations\‌​MAILTO\UserChoice.

似乎还显示所选应用程序的ProgID已被散列并且无法伪造,至少我不能告诉.

It also appears the ProgID of the selected app is hashed and can't be forged, at least not that I can tell.

有人对此有一个可行的方法吗?或者可以将指向我的实用程序类/代码指向概述如何以编程方式完成此操作的方法?

Does anyone have a working method for this, or can point me at a utility class/code that'll outline how to accomplish this programmatically?

对于代码,任何语言都可以.

For code, any language will do.

修改

在其他讨论中,我也被要求指定一个用例,因此我认为在此问题的上下文中会有所帮助.请考虑以下屏幕截图 https://github. com/shellscape/Gmail-Notifier-Plus/raw/master/Promotional/prefs-account.png 和允许用户指定mailto处理的复选框.在这种用例中,没有人会强迫用户,而是由用户控制并做出决定. Windows 8商店应用程序(都市/现代)具有可用的应用程序清单条目,可以自动执行上述丢失的过程,而台式机应用程序似乎不存在任何东西.

I've been asked from other discussions to specify a use-case, so I think it'd be helpful in the context of this question. Please consider this screenshot https://github.com/shellscape/Gmail-Notifier-Plus/raw/master/Promotional/prefs-account.png and the checkbox allowing the user to specify mailto handling. In this use-case, no one is forcing the user, the user is in control and makes the decision. While windows 8 store apps (metro/modern) have an available app manifest entry that automates the missing process described above, nothing seems to readily exist for desktop apps.

推荐答案

您可以将应用程序设置为通过自定义协议(例如mailto :)激活.当用户安装您的应用程序时,如果没有其他支持该协议的应用程序,则不会提示您,并且会自动为您分配该协议.

You can set your application to be activated by a custom protocol (like mailto:). When the user installs your app, if there is no other app supporting that protocol, they are not prompted and you are automatically assigned to that protocol.

但是,如果用户已经有一个处理该协议的应用程序,则系统将提示他们支持该协议的应用程序列表,并提供选择默认选项的选项.您不能强迫用户做出特定选择.

If, however, the user already has an app that handles that protocol, then they will be prompted with a list of apps who support that protocol with the option to select the default. You cannot force the user to make a specific selection.

此外,如果用户单击协议(例如myprotocol :),并且他们没有安装处理该协议的应用,则它们将被发送到商店(应用),该商店将自动搜索支持该协议的所有应用.然后,用户可以安装他们想要的任何东西.您不能强迫用户做出特定选择(如果有的话).

Also, if the user clicks on a protocol (like myprotocol:) and they have no app installed that handles that protocol then they will be sent to the store (app) which automatically searches for all apps that support that protocol. The user then installs whatever they want. You cannot force the user to make a specific selection (if any at all).

我写了一篇关于协议激活的文章.您可能会很感兴趣: http://blog. jerrynixon.com/2012/10/walkthrough-using-windows-8-custom.html

I wrote an article on protocol activation. It might be interesting to you: http://blog.jerrynixon.com/2012/10/walkthrough-using-windows-8-custom.html

这篇关于在Windows 8中以编程方式设置mailto:协议处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆