1个回答
展开全部
通过操作注册表可以实现
在模块中添加
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
在模块中添加
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
更多追问追答
追问
用你的代码显示:编译错误:要求常数表达式
追答
不好意思,把HKEY_LOCAL_MACHINE改成HKEY_CLASSES_ROOT
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询