How to set default browser in windows 8 using C#?(如何使用 C# 在 Windows 8 中设置默认浏览器?)
问题描述
在 Windows 8 之前(在 XP/VISTA/WIN7 中)我们都可以轻松做到这一点,只需对注册表进行少量更改即可.
We all have been easily able to do this prior to Windows 8 (in XP/VISTA/WIN7) with few changes in Registry and it was done.
在 Windows 8 中,这并不容易(我还没有弄清楚如何).Windows 8 也几乎没有下面提到的要更改的注册表设置,但除此之外,它还为每台计算机存储了一个唯一的哈希.任何人都可以帮助我为每台计算机或使用 Microsoft 提供的一些 API 来设置默认浏览器创建此哈希(SetAppAsDefaultAll"不起作用).以下是注册表项.
With Windows 8 it's not that easy (I'm yet to figure it out how). Windows 8 too has few registry settings to be changed mentioned below, but along with this it also stores a unique Hash for every computer. Can any body help me to possibly create this hash for every computer or with some API provided by Microsoft to set default browser ('SetAppAsDefaultAll' does not work). Following are the registry entries.
计算机HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.htmUserChoiceProgid : IE.AssocFile.HTM 哈希 : XXXXXXXXXXX
ComputerHKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.htmUserChoice Progid : IE.AssocFile.HTM Hash : XXXXXXXXXXX
计算机HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.htmlUserChoiceProgid : IE.AssocFile.HTM 哈希 : XXXXXXXXXXX
ComputerHKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.htmlUserChoice Progid : IE.AssocFile.HTM Hash : XXXXXXXXXXX
计算机HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.xhtUserChoiceProgid : IE.AssocFile.XHT 哈希 : XXXXXXXXXXX
ComputerHKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.xhtUserChoice Progid : IE.AssocFile.XHT Hash : XXXXXXXXXXX
计算机HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.xhtmlUserChoiceProgid:IE.AssocFile.XHT 哈希:
ComputerHKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.xhtmlUserChoice Progid : IE.AssocFile.XHT Hash :
计算机HKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationsftpUserChoiceProgid : IE.FTP 哈希 : XXXXXXXXXXX
ComputerHKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationsftpUserChoice Progid : IE.FTP Hash : XXXXXXXXXXX
计算机HKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationshttpUserChoiceProgid : IE.HTTP 哈希 : XXXXXXXXXXX
ComputerHKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationshttpUserChoice Progid : IE.HTTP Hash : XXXXXXXXXXX
计算机HKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationshttpsUserChoiceProgid:IE.HTTPS 哈希:XXXXXXXXXXX
ComputerHKEY_CURRENT_USERSoftwareMicrosoftWindowsShellAssociationsUrlAssociationshttpsUserChoice Progid : IE.HTTPS Hash : XXXXXXXXXXX
非常感谢.
推荐答案
致所有等待回答这个问题的人.
For all those waiting for answer to this question.
你去吧,看起来其中一种方法是通过 Win 8 提供的 DISM.exe.不过你的用户应该是机器的管理员.
Here you go, looks like that one of the way to do it is through DISM.exe provided by Win 8. Your user should be admin of the machine though.
使用 C# 代码,您应该能够使用特定参数运行此 DISM.exe.
Using C# code you should be able to run this DISM.exe with specific parameters.
以下博客有详细信息.
http://blogs.technet.com/b/mrmlcgn/archive/2013/02/26/windows-8-associate-a-file-type-or-protocol-with-a-specific-app-using-a-gpo-eg-default-mail-client-for-mailto-protocol.aspx
谢谢.
这篇关于如何使用 C# 在 Windows 8 中设置默认浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 C# 在 Windows 8 中设置默认浏览器?


- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01