打开Visual Basic 6.0开发工具,新建一个标准EXE工程。
右击工具箱,选择部件,在列表中选择Microsoft Internet Controls并单击确定。
在Form1窗体上添加一个TextBox控件、一个WebBrowser控件、三个CommandButton 控件。
控件布局如下图:

菜单内容:

再新建一个窗体,命名为AboutForm。(此窗体为关于窗口)
在窗体上新建一个Button控件、两个label控件。
控件布局如下:

Form1代码如下:
Dim i
// URL为Textbox控件
Private Sub AboutMe_Click(Index As Integer) //关于
AboutForm.Show
End Sub
Private Sub Command1_Click() //访问(→)
WebBrowser1.Navigate URL.Text
URL.Text = WebBrowser1.LocationURL
End Sub
Private Sub Command2_Click() //向前
On Error Resume Next
WebBrowser1.GoForward
URL.Text = WebBrowser1.LocationURL
End Sub
Private Sub Command3_Click() //返回
On Error Resume Next
WebBrowser1.GoBack
URL.Text = WebBrowser1.LocationURL
End Sub
Private Sub Exit_Click(Index As Integer) //退出
End
End Sub
Private Sub InternetOption_Click(Index As Integer) //Internet 选项
i = Shell("Opt.bat", vbMinimizedNoFocus)
End Sub
Private Sub NewWin_Click(Index As Integer) //新建浏览窗口
Dim NewWindow As New MainForm
NewWindow.Show
End Sub
Private Sub Retry_Click(Index As Integer) //重新加载网页
WebBrowser1.Refresh
End Sub
?因为Internet 选项窗口为cpl文件,所以创建一个Opt.bat文件来打开它。
Opt.bat文件内容如下:
@echo off
inetcpl.cpl
“关于”窗口代码:
Command1.Enabled = False
运行结果:

源代码下载链接:https://download.csdn.net/download/Ethan0331/80447628
|