Make a Moderate Web-Browser
Yay for my 1st tutorial :)
Ok, so make your new form.
Now, go to components (Ctrl+T) and find "microsoft internet controls" Check it and click OK
now click the Earth Icon thingy, and make your Internet viewing part. Name it something simple, like "w"
Make a text box On top, for the Address, and 5 buttons also, (back, foward, home, stop, and refresh). then make a button next to the text-box and make the caption "go"
you might want at start the web browser to navigate to the home page or another page. type this code in:
Code
Private Sub Form_Load()
w.GoHome
w.Silent = True
End Sub
(if you want it to go to a webpage, instead of gohome, put navigate "http://yoursite.com")
the silent part makes it so your web browser shows no errors.
Now name the address bar something simple, like "T". and type this code in:
Code
Private Sub T_Change()
w.Navigate T.Text
End Sub
Then, every time you type in a site in the address bar, it will go there. Now name the go button "Go". type this code in:
Code
Private Sub Go_Click()
w.Navigate T.Text
End Sub
Now name the buttons back, forward, stop, refresh, and home.
put this code in:
Code
Private Sub back_Click()
On Error Resume Next
w.GoBack
End Sub
Private Sub forward_Click()
On Error Resume Next
w.GoForward
End Sub
Private Sub home_Click()
On Error Resume Next
w.GoHome
End Sub
Private Sub refresh_Click()
On Error Resume Next
w.refresh
End Sub
Private Sub stop_Click()
On Error Resume Next
w.stop
End Sub
Now you have all the buttons.
____________________________
Now maybe you want to have some advanced stuff?
Ok, make a menu now (right click > menu editor)
Make it like this:
File
....Save
....Print page
....Properties
....View Source
....Quit
name them A B C D E and F in consecutive order.
now type this code in:
Code
Private Sub B_Click()
w.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DODEFAULT
End Sub
Private Sub C_Click()
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT
End Sub
Private Sub D_Click()
WebBrowser1.ExecWB OLECMDID_PROPERTIES, OLECMDEXECOPT_DODEFAULT
End Sub
Private Sub F_Click()
Unload Me
End Sub
We will now make a new form for the view source part. go to Project > add form.
make a textbox on it and call it Source.
now add this code:
Code
Private Sub E_Click()
Form2.Visible = True
Form2.Source = Form1.w.Document.documentElement.innerHTML
End Sub
make sure form2 was previously hidden.
now to make the web browser resize when u change the window. find the difference betweeen your browser and window. this involves a little math :( (just subtract the height of the browser from the height of the form. I got 1890) make a timer called timer1. set the interval to something like 1-100. now add this code:
Code
Private Sub Timer1_Timer()
On Error Resume Next
w.Width = Me.ScaleWidth
w.Height = Me.ScaleHeight - 1890
End Sub
make sure to replace 1890 with your number.
ok i may add more later, but now i have 2 go eat pizza :)
i will add the source code and the EXE to the downloads section ASAP