Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 16
0 Users 3 Guests Online

Make a Moderate Web-Browser - Part 2

Ok, here is part2 of how 2 make a moderate web browser. you can either download the 1st 1/2 or use the tutorial

Tut:http://rmb-scripting.com/tutorials.php?tutorial&tid=271
DL:http://rmb-scripting.com/downloads.php?download&id=29

_________________


OK, First lets add a search. Make 1 text box and 3 buttons. Name the Textbox SB and the buttons s01 s02 and s03. Now add this code:
Code
Private Sub s01_Click()
w.Navigate "http://www.google.com/search?q=" & SB.Text
End Sub

Private Sub s02_Click()
w.Navigate "http://search.yahoo.com/search?p=" & SB.Text
End Sub

Private Sub s03_Click()
w.Navigate "http://search.msn.com/results.aspx?q=" & SB.Text
End Sub


Ok, that is how you do add the searches.

________________

Now lets add history. Make another form called "form3"

add a combo box to it named "CB"

Now in the menu editor, make 1 named "G" and captioned "history". Add the following code:
Code
Private Sub w_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
Dim I As Integer
Dim bFound As Boolean
Me.Caption = w.LocationName & " - Zar Browser"
T.Text = w.LocationURL
For I = 0 To Form3.CB.ListCount - 1
If Form3.CB.List(I) = w.LocationURL Then
bFound = True
Exit For
End If
Next I
mbDontNavigateNow = True
If bFound Then
Form3.CB.RemoveItem I
End If
Form3.CB.AddItem w.LocationURL, 0
Form3.CB.ListIndex = 0
mbDontNavigateNow = False
End Sub

Private Sub G_Click()
Form3.Visible = True
End Sub

Now, when you navigate to a site, the URL will go to the adressbar, and the Name will go to the title of the browser as well as the history being recorded.

___________________

Now to block popups. Its pretty simple, just add this code:
Code
Private Function IsPopupWindow() As Boolean
On Error Resume Next
If w.Document.activeElement.tagName = "BODY" Or w.Document.activeElement.tagName = "IFRAME" Then
IsPopupWindow = True
Else
IsPopupWindow = False
End If
End Function

Private Sub w_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim frm As Form1
Cancel = IsPopupWindow
If Cancel = False Then
Set frm = New Form1
Set ppDisp = frm.w.object
frm.Show
End If
End Sub

now you pop the blockups.

________________________

O yeah, and i found out in the other browser, the properties and print dont work, so add this code instead:
Code
Private Sub C_Click()
w.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DODEFAULT
End Sub

Private Sub D_Click()
w.ExecWB OLECMDID_PROPERTIES, OLECMDEXECOPT_DODEFAULT
End Sub



You can also add an open option. Go to menu editor and add an option called "Open". Name it "L"
now add this code:
Code
Private Sub L_Click()
w.ExecWB OLECMDID_OPEN, OLECMDEXECOPT_DODEFAULT
End Sub


____________________________

Now you can add some Edit commands. Like copy, paste, cut, and so forth.
Go to menu Editor, and do this:

Edit (name=M)
....Undo (name=N)
....Redo (name=O)
.... (Uncheck enabled)(name=P)
....Cut (name=Q)
....Copy (name=R)
....Paste (name=S)
....Delete (name=U)
....Find (name=v)

Now add this code:
Code
Private Sub N_Click()
w.ExecWB OLECMDID_UNDO, OLECMDEXECOPT_DODEFAULT
End Sub

Private Sub O_Click()
w.ExecWB OLECMDID_REDO, OLECMDEXECOPT_DODEFAULT
End Sub

Private Sub Q_Click()
w.ExecWB OLECMDID_CUT, OLECMDEXECOPT_DODEFAULT
End Sub

Private Sub R_Click()
w.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
End Sub

Private Sub S_Click()
w.ExecWB OLECMDID_PASTE, OLECMDEXECOPT_DODEFAULT
End Sub

Private Sub U_Click(Index As Integer)
w.ExecWB OLECMDID_DELETE, OLECMDEXECOPT_DODEFAULT
End Sub

Private Sub V_Click()
w.ExecWB OLECMDID_FIND, OLECMDEXECOPT_DODEFAULT
End Sub


I now took the time 2 add shortcuts to all of the menu links. You may do so if you please. just choose something under "shortcut:"

_____________________________

now you can jazz up your webbrowser. Add anything you like. If this tutorial is too hard or something 2 read (which i know im bad at making tuts), then you can just download the source.
zar
Author:
Views:
2814
Rating:
Posted on Thursday 27th December 2007 at 03:01 PM
Dalez
Dalez
The history doesn't work, and the most of the edit doesn't. Also, I can't get the buttons to work (1st tut) keeps saying that the code is wrong. Atm i'm using no buttons
Posted on Thursday 27th December 2007 at 03:01 PM
Dalez
Dalez
The history doesn't work, and the most of the edit doesn't. Also, I can't get the buttons to work (1st tut) keeps saying that the code is wrong. Atm i'm using no buttons
Posted on Tuesday 4th December 2007 at 10:57 PM
zar
zar
o yeah, u have 2 make the Name for find a capital V. u probably made it lower case


sorry for 3rd comment :(
Posted on Tuesday 4th December 2007 at 10:52 PM
zar
zar
i found out that open isnt supported anymore :( but it still displays it as correct in code.
Posted on Tuesday 4th December 2007 at 10:49 PM
zar
zar
code for find:

Code
Private Sub V_Click()
w.ExecWB OLECMDID_FIND, OLECMDEXECOPT_DODEFAULT
End Sub


open is being stupid :(
Posted on Tuesday 4th December 2007 at 12:10 AM
ShadowMage
ShadowMage
Sorry for double comment but find doesnt either o.o
Posted on Monday 3rd December 2007 at 11:57 PM
ShadowMage
ShadowMage
Open doesn't work for me o.o