vb怎样设置或恢复ie为默认浏览器?

发布网友 发布时间:2022-02-25 12:57

我来回答

1个回答

热心网友 时间:2022-02-25 14:27

通过操作注册表可以实现
在模块中添加
Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Public Const REG_SZ = 1
Public Const READ_CONTROL = &H20000
Public Const STANDARD_RIGHTS_WRITE = (READ_CONTROL)
Public Const KEY_SET_VALUE = &H2
Public Const SYNCHRONIZE = &H100000
Public Const KEY_WRITE = ((STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And (Not SYNCHRONIZE))
Public Const HKEY_CLASSES_ROOT = &H80000000

在窗体某一合件中(如按钮的单击)添加代码:

RegOpenKeyEx HKEY_LOCAL_MACHINE, "http\shell\open\command", 0, KEY_WRITE, hhKey
RegSetValueEx hhKey, "", 0, REG_SZ, ByVal "C:\Program Files\Internet Explorer\iexplore.exe -nohome", 55
RegCloseKey hhKey
RegOpenKeyEx HKEY_LOCAL_MACHINE, "http\shell\open\ddeexec\Application", 0, KEY_WRITE, hhKey
RegSetValueEx hhKey, "", 0, REG_SZ, ByVal "IExplore",8
RegCloseKey hhKey

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com