一个简单的通过修改注册表设置IE首页的方法,别用它来做流氓哦
注意本文内容只针对IE浏览器.
记得以前遇到过一个流氓,篡改IE首页,然后在IE选项中主页设置里面禁止了[使用当前页][使用默认页][使用空白页]这几个按钮(灰色).其实这些个人认为也都可以通过修改注册表来实现的.
本文代码大概实现修改IE首页的流程 修改注册表代码 - 生成批处理 - 执行 - KILL批处理
主要应用代码
@reg delete "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /f
@reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /d "http://www.islandcn.com" /f
下面看VB的源代码,通过一个按钮实现的
Dim BatStr1 As String
Dim BatStr2 As String
Private Sub BtnOK_Click()
BatStr1 = "@reg delete " & """" & "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" & """" & " /v " & """" & "Start Page" & """" & " /f"
BatStr2 = "@reg add " & """" & "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" & """" & " /v " & """" & "Start Page" & """" & " /d " & """" & "http://www.islandcn.com" & """" & " /f"
If MsgBox("是否把www.islandcn.com设为您的首页?", vbQuestion + vbOKCancel) = vbOK Then
Open App.Path & "\" & "TempBat.bat" For Output As #1 '将修改注册表代码写入名为 TempBat.bat的批处理中
Print #1, BatStr1 & vbCrLf & BatStr2
Close #1
Shell App.Path & "\" & "TempBat.bat" '执行批处理
MsgBox "Successful.."
Kill App.Path & "\" & "TempBat.bat" '删除临时批处理
End If
End Sub
版权所有,转载时必须以链接形式注明作者和原始出处及本声明:KingLife@无忧岛
本文链接: http://www.islandcn.com/post/328.html
最近评论