如何设置Microsoft Edge文件关联以打开.htm文件? [英] How to set up Microsoft Edge file association to open .htm files?

查看:559
本文介绍了如何设置Microsoft Edge文件关联以打开.htm文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的软件中,我使用的是 ShellExecuteEx 打开一个以本地.htm文件形式显示的报告.有时在某些最终用户系统上,.htm文件没有默认的文件关联.

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.

要在Windows 10之前的系统上设置此类文件关联,我将安装以下注册表项以使用IE:

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

然后我将更改通知Windows资源管理器

Then I notify Windows Explorer of the change:

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);

它运行良好,但是您如何在Windows 10上对Microsoft Edge进行同样的操作?

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

PS ::
我不想在那里使用IE,因为它总是显示带有nag的额外选项卡以切换到Edge,这对我的最终用户非常困惑.

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.

推荐答案

在Windows 10上,它是通过 IApplicationAssociationRegistrationInternal (" 2a848e25-d688-4aa3-8e55-0c16cb3a2dfb >)

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

使用 SHCreateAssociationRegistration 创建

为Microsoft Edge ProgId设置" AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9 "

Set "AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9" for Microsoft Edge ProgId

(在 Windows 10-1803,17134.820 上进行了测试)

这篇关于如何设置Microsoft Edge文件关联以打开.htm文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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