Author : Buddhika Fernando.
Date Submitted : 6/12/2006
Category : Internet
Compatibility : VB 6,VB 5
This code has been accessed 9395 times.
Task : Simple Web Browser.
Declarations
Code
Private Sub Form_Load()
PHwnd = StatusBar1.hWnd
CHwnd = ProgressBar1.hWnd
SetParent CHwnd, PHwnd
ProgressBar1.Move 5, StatusBar1.Panels(1).Left
ProgressBar1.Width = StatusBar1.Panels(1).Width
ProgressBar1.Height = StatusBar1.Height
ProgressBar1.Visible = False
End Sub
Private Sub Form_Resize()
On Error Resume Next
Text1.Move 50, 120, ScaleWidth - 100, 285
WebBrowser1.Move 50, 480, ScaleWidth - 100, ScaleHeight - 800
StatusBar1.Panels(2).Width = Me.Width - StatusBar1.Panels(1).Width
End Sub
Private Sub Text1_GotFocus()
With Text1
.SelStart = 0
.SelLength = Len(.Text)
.Refresh
End With
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.Caption = "Gehan's Web Browser :-"
WebBrowser1.Navigate2 Trim(Text1.Text): DoEvents
Me.Caption = "Gehan's Web Browser :- " & WebBrowser1.LocationName
End If
End Sub
Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
If Progress < 1 Then Exit Sub
ProgressBar1.Visible = True
If CInt(((Progress / ProgressMax) * 100)) = 100 Then
ProgressBar1.Value = 100
StatusBar1.Panels(2).Text = "Done"
Me.Caption = "Gehan's Web Browser :-"
ProgressBar1.Visible = False
Else
DoEvents
ProgressBar1.Value = CInt(((Progress / ProgressMax) * 100))
Me.Caption = "Gehan's Web Browser :- " & WebBrowser1.LocationName
StatusBar1.Panels(2).Text = WebBrowser1.LocationURL
End If
End Sub