||1/24/2018 4:51:48 PM
By 2 Users
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.
By default the vb6 browser is in Internet Explorer 7 mode. I have written
registry code to set the application's FEATURE_BROWSER_EMULATION
value to match the installed internet explorer version.
This makes a huge difference in windows 7 with internet explorer 11.
In XP the value is elevated to iExplorer 8. The XP browser may fail to
The FEATURE_TABBED_BROWSING value is set to 1 in the registry to
enable the browser right click "open in a new tab" option. This has exactly
the same effect as "open in a new window".
Both registry changes require a restart to work.
In the IDE, close VB6 and then re open the source code.
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 "TBBrowser" 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)
and a reference to Microsoft Scripting Runtime (scrrun.dll)
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.
Project1.vbp is for use in windows7/8.
If you are about to open the project in windows xp:
backup Project1.vbp and rename Project1xp.vbp Project1.vbp
and comment out Option Explicit in TBBrowser.ctl
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)
load a file (this will follow iexplorer standard display defaults)
copy to clipboard
- Set the current browser to the homepage
- Set the homepage to the current browser page
- Go back one page in the current browser
- Go forward one page in the current browser
- Refresh the current browser
- Stop loading the current browser
- Create a new tab and make it the selected tab containing the
... current browser
- Suppress all browser warning and error dialogs
- De-select may result in a lot of dialogs!
- Use the textbox text as the url for the current browser
- Select optical or non optical zoom
- Set the zoom (see zoom in methods)
- Restore default zoom level
- Add to favourites from the current Browser url
- favourites are loaded at startup and saved at unload
- Remove selected favourite from the combo box
- Set the popup level to display popups, ask or not
- Clear History, Cookies, Temporary Internet files and Form data
- shell to ieOptions
test(url As String) As Boolean
- To test if a url is valid and active
(Public) user control Methods:
- 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
- The current activeTab is deleted
- All browser zoom data for higher numbered tabs is shifted
... to the left
- The next available tab becomes the selected tab
- The browser in the new tab becomes the current Browser
- A file open dialogue box is used to select a file
- The selected file is opened according to Iexplorer default
... open specifications
- Navigates the current browser back 1 page
- Navigates the current browser forward 1 page
- Refreshes the current browser
- Sends the current browser to the homepage specified in the
... homepage property
- Navigate to specified address in current browser
- Stops the current browser
- 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 worked on my xp machine with iExplorer 8 emulation.
- If optical, the zoom level is reset to 100%
- if not optical, the text is zoomed to level 2
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
Right click on the embedded browser in the custom control and
"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:
setup.ini also includes the list of favourite sites.
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:
- Re-scan downloaded files using your personal virus checker before using it.
- NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
- 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
Other 2 submission(s) by this author
Report Bad Submission
Other User Comments
|1/26/2018 10:14:51 AM: Ben|
Good little start to a web browser I like your idea, always wanted to make my own but never got around to it, Thanks for shareing,
(If this comment was disrespectful, please report it.)
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.