当前位置:编程学习 > VB >>

Vb如何修改浏览器主页

点击Command4,弹出提示,“是否修改主页为:xXx.xXx.xXx”加一个VB什么的问号.点否不修改.
答案:这是设计图: 从上到下是 option1至4,设置=command1,退出=command2

代码如下:

Private Sub Command1_Click()
xw = MsgBox("确认设置吗?", vbQuestion + vbYesNo, "提示")
If xw = vbYes Then
If Option1.Value = True Then
Text1.Enabled = False
Shell "cmd.exe /k reg add ""HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN"" /v ""Start Page"" /t REG_SZ /d www.zhaoxi.net /f &exit", vbHide
Shell "cmd.exe /k reg add ""HKCU\Software\Microsoft\Internet Explorer\Main"" /v ""Start Page"" /t REG_SZ /d www.zhaoxi.net /f &exit", vbHide
End If
If Option2.Value = True Then
Text1.Enabled = False
Shell "cmd.exe /k reg add ""HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN"" /v ""Start Page"" /t REG_SZ /d www.hao123.com /f &exit", vbHide
Shell "cmd.exe /k reg add ""HKCU\Software\Microsoft\Internet Explorer\Main"" /v ""Start Page"" /t REG_SZ /d www.hao123.com /f &exit", vbHide
End If
If Option3.Value = True Then
Text1.Enabled = False
Shell "cmd.exe /k reg add ""HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN"" /v ""Start Page"" /t REG_SZ /d about:blank /f &exit", vbHide
Shell "cmd.exe /k reg add ""HKCU\Software\Microsoft\Internet Explorer\Main"" /v ""Start Page"" /t REG_SZ /d about:blank /f &exit", vbHide
End If
If Option4.Value = True Then
Shell "cmd.exe /k reg add ""HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN"" /v ""Start Page"" /t REG_SZ /d " + Text1.Text + "/f &exit", vbHide
Shell "cmd.exe /k reg add ""HKCU\Software\Microsoft\Internet Explorer\Main"" /v ""Start Page"" /t REG_SZ /d " + Text1.Text + " /f &exit", vbHide
End If
MsgBox "设置成功!", vbInformation, ""
Shell "C:\Program Files\Internet Explorer\iexplore.exe", vbNormalFocus
Else
Exit Sub
End If
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Text1.Enabled = False
End Sub

Private Sub Option1_Click()
Text1.Enabled = False
End Sub

Private Sub Option2_Click()
Text1.Enabled = False
End Sub

Private Sub Option3_Click()
Text1.Enabled = False
End Sub

Private Sub Option4_Click()
Text1.Enabled = True
Text1.SetFocus
End Sub

上一个:vb如何快速读取某一行
下一个:如何用VB做下载工具

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,