Forgot Password / Register
Site Statistics
Total Members: 508
Total Tutorials: 242
Newsest User: TEMP
Todays Unique Hits: 12
0 Users 2 Guests Online

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
zar
Author:
Views:
1437
Rating:
Posted on Monday 31st December 2007 at 04:15 PM
zar
zar
happened to me b4. reinstalling IE7 works for some people, you could also open "shdocvw.dll" instead.
Posted on Wednesday 26th December 2007 at 04:12 PM
Dalez
Dalez
When i try to make it a Microsoft Internet Controls it just says 'File not found: c:windowssystem32ieframe.dll1' What do i do?
Posted on Monday 3rd December 2007 at 02:31 AM
ShadowMage
ShadowMage
I'll post a dl of the random one i made O_o'
Posted on Sunday 2nd December 2007 at 05:37 PM
zar
zar
http://rmb-scripting.com/downloads.php?download&id=29

thats the download
Posted on Sunday 2nd December 2007 at 02:40 AM
ShadowMage
ShadowMage
Okay cool
Posted on Sunday 2nd December 2007 at 01:38 AM
zar
zar
I am also only 1/2 way done. i will try and finish 2morrow.
Posted on Sunday 2nd December 2007 at 12:10 AM
ShadowMage
ShadowMage
I use 2005 .net and 2008.net yet i love vb6 still for some stuff x] I've got a nice little web browser going in it been pondering on upgrading it to .net reliable and such but .net doesn't support sRet objects. -_-
Posted on Sunday 2nd December 2007 at 12:07 AM
MOD-Dan
MOD-Dan
Yeh but a lot of people still code in VB6 as its very reliable and easy to code in. The newer updated versions are becoming more and more harder to learn and use XD
Posted on Sunday 2nd December 2007 at 12:05 AM
darklight19
darklight19
You may want to switch from VB6 to VB9 or 10 I think it is.
Posted on Saturday 1st December 2007 at 10:35 PM
ShadowMage
ShadowMage
Looks good =D