Option Explicit
Private Sub Form_Load()
Me.Caption = "My Explorer"
Label1.Caption = "URL"
Combo1.Text = ""
Combo1.Top = Label1.Height
Combo1.Left = 0
WebBrowser1.Top = Combo1.Top + Combo1.Height
WebBrowser1.Left = 0
Form_Resize
StatusBar1.Style = sbrSimple
ProgressBar1.ZOrder
End Sub
Private Sub Form_Resize()
On Error GoTo a
Combo1.Width = Form1.Width - 100
WebBrowser1.Width = Combo1.Width
WebBrowser1.Height = Form1.Height - Combo1.Height - 1000
ProgressBar1.Top = Me.Height - StatusBar1.Height - 330
ProgressBar1.Left = 0.25 * StatusBar1.Width
ProgressBar1.Width = 0.75 * Me.Width - 250
a:
End Sub
Private Sub Combo1_Click()
WebBrowser1.Navigate Combo1.Text
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim I As Long
Dim existed As Boolean
If KeyCode = 13 Then
If Left(Combo1.Text, 7) <> "http://" Then
Combo1.Text = "http://" + Combo1.Text
End If
WebBrowser1.Navigate Combo1.Text
For I = 0 To Combo1.ListCount - 1
If Combo1.List(I) = Combo1.Text Then
existed = True
Exit For
Else
existed = False
End If
Next
If Not existed Then
Combo1.AddItem (Combo1.Text)
End If
End If
End Sub
Private Sub WebBrowser1_DownloadBegin()
StatusBar1.SimpleText = "Now Linking..."
End Sub
Private Sub WebBrowser1_DownloadComplete()
StatusBar1.SimpleText = "Link Finished"
ProgressBar1.Value = 0
End Sub
Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
If ProgressMax = 0 Then Exit Sub
ProgressBar1.Max = ProgressMax
If Progress <> -1 And Progress <= ProgressMax Then
ProgressBar1.Value = Progress
End If
End Sub
Private Sub WebBrowser1_TitleChange(ByVal Text As String)
Combo1.Text = WebBrowser1.LocationURL
End Sub
新建一个窗体
在窗体中的工程里面添加
microsoft internet controls
microsoft internet transfer control 6.0
microsoft windows common controls 6.0
三个控件(vb6.0企业版里面有)
在窗体上添加
一个StatusBar1(右边工具栏)
一个ProgressBar1
一个Combo1
一个Label1
一个WebBrowser1
位置和大小随便放
在代码里面复制上面的代码
运行
网址如www.baidu.com
复制代码时注意Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long) 会变红色 这个代码在一行的 由于百度的网页宽度不够 所以复制是可能是2行
vb我不会,但我有一个解决方法,因为我也遇到了这样的问题自己解决了.
1,建一个文本文件,输入下面代码:
2,http://www.lexisnexis.com 替换成你想要的网站,并将文件扩展名改为.htm或html
3,添加压缩,自解压格式.注意选项参数.
添加解压后运行htm文件,把覆盖,询问都选为否定.这样才会安静.添加图标,ICO文件.这样别人不会一眼看破是解压文件.目的是更像程序.还可以创建快捷方式.选择解压路径.
具体步骤,我不太会描述,你自己摸索下吧.
CTRL+T 里面找Microsoft Internet Controls
然后只写下列代码
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.baidu.com"
End Sub
public sub form_load()
shell ("浏览器程序地址 网址")
end sub
说的具体一点