article

Tabbed Browser

Email
Submitted on: 1/13/2018 10:28:43 PM
By: David Patterson 
Level: Advanced
User Rating: Unrated
Compatibility: VB 6.0
Views: 360
 
     The browser is based on the custom control written by Ken R. Beaudry.
Having decided to write a browser, I looked for a starting point.
Ken's custom control was the perfect starter solution.
After some de-bugging, re-coding and enhancing I now have a very useful Browser.
Most of the coding is contained within the control, which produces a drop in web browsing solution (which would suit all ranges of programming experience!)
No modules or classes are used.

Ken's browser can be found at http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=39764&lngWId=1&txtForceRefresh=17201811334710023

This article has accompanying files

 
				
The browser form opens to the fit the screen, with maximum size tabs. The embedded browsers fill the Tabs. New tabs open "tab.htm", which can be amended as required.
The application has been tested on XP, windows 7 and win 8.
The browsers may fail to compile some recent javascript. I suspect this is because the vb6 browser control is based on older versions of IExplorer, particulaly in the case of XP. However this does mean a lot of advertising simply does not appear!
Javascript and Navigation errors are trapped and displayed in the status bar.
To enable audio warning about javascript errors include ding.wav. For audio warning about Navigation errors include notify.wav.
Audio can be toggled on or off.
Data persistency is achieved with a simple setup.ini file.
The following VB6 controls are used: Microsoft Common Dialog Control 6.0 (SP6): COMDLG32.OCX Microsoft Internet Controls: ieframe.dll (ref ieframe.oca) Microsoft Windows Common Controls 6.0 (SP6): MSCOMCTL.OCX
=============== !! Important !! ===============
If you create a new application and use the tabbed "bbrowser" control or the form test function... You will need to add the following reference(s):
The control requires a reference to: Microsoft HTML Object Library using Project->References mshtml.tlb
The form test function also requires a reference to: Microsoft XML, V6.0 using Project->References msxml6.dll
Remember to include tab.htm, abarule.gif and the wav files as required.
If you are about to open the project in windows xp:
backup Project1.vbp and rename Project1xp.vbp Project1.vbp
Custom control usage: ---------------------
1) Draw the control on your target form 2) Add any buttons,textboxes and combos you want to augment its use. 3) Assign functions to the buttons to control movement, tabs, homepage, refresh etc. 4) Call TBBrowser.re_Init to initialse default values (if required) 5) Set any properties as required 6) Initialize the control with: TBBrowser.InitControl Me, "somewhere.com" or TBBrowser.InitControl Me, TBBrowser.homepage
Tab right click menu: ---------------------
delete active tab (Except for the last one left) page setup print preview print page save load a file (this will follow iexplorer standard display defaults)
Form Functions: ----------------
goHome_Click - Set the current browser to the homepage
setHome_Click - Set the homepage to the current browser page
goBack_Click - Go back one page in the current browser
goForward_Click - Go forward one page in the current browser
goReload_Click - Refresh the current browser
goStop_Click - Stop loading the current browser
newTab_Click - Create a new tab and make it the selected tab containing the ... current browser
Silent_Click - Suppress all browser warning and error dialogs - De-select may result in a lot of dialogs!
Audio_Click - Stop audio warnings after navigation and javascript errors
myGo_Click - Use the textbox text as the url for the current browser
optical_Click - Select optical or non optical zoom
zoom_Click() - Set the zoom (see zoom in methods)
clear_Zoom_Click - Restore default zoom level
addFavourite_Click - Add to favourites from the current Browser url - favourites are loaded at startup and saved at unload
Subtract_Click - Remove selected favourite from the combo box
popups_Click - Set the popup level to display popups, ask or not
deleteHistory_Click - Clear History, Cookies, Temporary Internet files and Form data
ieOptions_Click - shell to ieOptions
test(url As String) As Boolean - To test if a url is valid and active
(Public) user control Methods: ------------------------------
re_Init() - Set some default contol properties - homepage = "https://uk.search.yahoo.com/" - StatusVisable = True - popups = allow - isOptical = True - isSilent = True - useAudio = True
InitControl(theform As Form, StartUrl As String) - sets the size of the control to the size of the calling form ... passed through "theform" - loads the StartUrl into tab 1
newTab(url As String, Optional Options As Integer) - Creates a new browser tab and loads the specified URL - Options not in use
SelectTab(ByVal index As Integer, ByVal oldtab As Integer) - Sets the specified index tab to current and brings it's ... browser to the front - oldtab is used to switch the previous tab caption - If oldtab < 1 then previous tab operations are ignored
DeleteTab() - The current activeTab is deleted - All browser zoom data for higher numberd tabs is shifted ... to the left - The next available tab becomes the selected tab - The browser in the new tab becomes the current Browser
loadFile() - A file open dialogue box is used to select a file - The selected file is opened according to Iexplorer default ... open specifications
Back - Navigates the current browser back 1 page
Forward - Navigates the current browser forward 1 page
Refresh - Refreshes the current browser
Home - Sends the current browser to the homepage specified in the ... homepage property
webGo - Navigate to specified address in current browser
Stop1 - Stops the current browser
zoom - If optical the zoom level increases by 25%, incrementally ... up to 600% - If not optical, the text is zoomed to level 4 (level 2 is the default) - Each browser has a separate zoom level - Optical zoom did not work on my xp machine with iExplorer 8
clearZoom - If optical, the zoom level is reset to 100% - if not optical, the text is zoomed to level 2
Right click menu Options: -------------------------
delete active tab page setup print preview print page save load a file
Properties: -----------
isOptical - Optical zoom if true, text zoom if false useAudio - Audio warning after navigation or script error isSilent - Browser does not open a dialog for most errors numtabs - Holds the number of visible tabs CurrentBrowser - Holds the currently selected Browser Tab CustomError - Custom Navigation error StatusVisable - Toggles whether the status bar is visible CurrentAddress - Holds The URL of the displayed page Popups - Sets whether to display popups, ask or not homepage - Sets/Stores current homepage
To view the default properties: ------------------------------- Select the tabbedBrowser form in view object mode. Right click on the green background of the form and select update UserControls. Right click on the embedded browser in the custom control and select Properties. "PropertyTBBrowser" will open with the default property values.
N.B. the following properties are stored in setup.ini as the application unloads and restored on opening: homepage isOptical isSilent useAudio Popups
setup.ini also includes the list of favourite sites.
D.R.Patterson 13/1/2018

winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.