How to set up Microsoft Edge file association to open .htm files?

孤人 提交于 2019-12-25 02:44:16

问题


In my software I'm using ShellExecuteEx to open a report that is presented as a local .htm file. At times on some end-user systems there's no default file association for the .htm files.

To set such file association up on a pre-Windows 10 system I'd install the following registry keys to use IE:

Key: HKEY_CURRENT_USER\Software\Classes\htm.file\Shell\open\Command
REG_SZ name: ""
REG_SZ value: "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "%1"

Key: HKEY_CURRENT_USER\Software\Classes\.htm
REG_SZ name: ""
REG_SZ value: htm.file

Key: HKEY_CURRENT_USER\Software\Classes\.htm
REG_SZ name: PerceivedType
REG_SZ value: Document

Then I notify Windows Explorer of the change:

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);

It works well, but how do you do the same for Microsoft Edge on Windows 10?

PS.:
I don't want to use IE there because it always shows an extra tab with the nag to switch to Edge, which is very confusing for my end-users.


回答1:


On Windows 10, it is done with IApplicationAssociationRegistrationInternal ("2a848e25-d688-4aa3-8e55-0c16cb3a2dfb")

created with SHCreateAssociationRegistration

Set "AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9" for Microsoft Edge ProgId

(tested on Windows 10 - 1803, 17134.820)



来源:https://stackoverflow.com/questions/52862676/how-to-set-up-microsoft-edge-file-association-to-open-htm-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!