在WPF XBAP項目中遇到這樣一個問題,程序在Windows 10上面無法運(yùn)行。原因是因為Windows 10默認(rèn)瀏覽器是Edge,而XBAP程序是需要在IE上面運(yùn)行的。于是開始想辦法修改Windows 10的默認(rèn)瀏覽器。在Windows 10之前,只需要修改注冊表的就可以了。將下面注冊表的ProgId設(shè)置為IE.HTTP/IE.HTTPS即可。

HKEY_CURRENT_USER\ Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice
HKEY_CURRENT_USER\ Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice

Code:

復(fù)制代碼
class Program
{ private const string HTTP_KEY = @"Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice"; private const string HTTPS_KEY = @"Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice"; static void Main(
        		

網(wǎng)友評論