VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple Web Browser.

by Buddhika Fernando. (6 Submissions)
Category: Internet/HTML
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 6th December 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Simple Web Browser.

API Declarations



Rem --- Give Your Comments To Make Complete And Powerful Web Brower
Private Declare Function SetParent Lib "user32.dll" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long

Dim PHwnd As Long
Dim CHwnd As Long

Use One Textbox,Web Control,Progress Bar And Status Bar.

Rate Simple Web Browser.




    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


Download this snippet    Add to My Saved Code

Simple Web Browser. Comments

No comments have been posted about Simple Web Browser.. Why not be the first to post a comment about Simple Web Browser..

Post your comment

Subject:
Message:
0/1000 characters