Microsoft & .NETVisual BasicDevelop Your Own Browser - Part 2

Develop Your Own Browser – Part 2

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

This is the second part of the Develop Your Own Browser. To view part 1, click here.

In this article you’ll learn how to copy, select all, view source, edit with Frontpage and edit with Visual Interdev.

Dim eQuery As OLECMDF    return value type for QueryStatusWBOn Error Resume NexteQuery = brwwebbrowser.QueryStatusWB(OLECMDID_COPY)If Err.Number = 0 ThenIf eQuery And OLECMDF_ENABLED Thenbrwwebbrowser.ExecWB OLECMDID_COPY, _                     OLECMDEXECOPT_PROMPTUSER, _                     ,       Ok to Print?End IfEnd If

Dim eQuery As OLECMDF    return value type for QueryStatusWBOn Error Resume NexteQuery = brwwebbrowser.QueryStatusWB(OLECMDID_SELECTALL)If Err.Number = 0 ThenIf eQuery And OLECMDF_ENABLED Thenbrwwebbrowser.ExecWB OLECMDID_SELECTALL, _                     OLECMDEXECOPT_PROMPTUSER, _                     ,     Ok to Print?ElseMsgBox The Print command is currently disabled.End IfEnd If

Insert Inet Control (Name – Inet1)
Insert This line into your Module Declaration Section

Public Declare Function ShellExecute _       Lib shell32.dll Alias ShellExecuteA _       (ByVal hWnd As Long, _       ByVal lpOperation As String, _       ByVal lpFile As String, _       ByVal lpParameters As String, _       ByVal lpDirectory As String, _       ByVal nShowCmd As Long) As LongPublic Const SW_SHOW = 5Type SHELLEXECUTEINFO  cbSize As Long  fMask As Long  hWnd As Long  lpVerb As String  lpFile As String  lpParameters As String  lpDirectory As String  nShow As Long  hInstApp As Long  lpIDList As Long  lpClass As String  hkeyClass As Long  dwHotKey As Long  hIcon As Long  hProcess As LongEnd Type

Insert these coding into your click Event:

On Error Resume NextDim lrs As Stringlrs = C:windowstemp.htmDim b() As ByteInet1.CancelInet1.Protocol = icHTTPInet1.URL = WebBrowser1.LocationNameIf Inet1.URL <>  Thenb() = Inet1.OpenURL(, icByteArray)Open lrs For Binary Access Write As #1Put #1, , b()Close #1Dim retval As Longretval = ShellExecute(Me.hWnd, open, _         C:windowsnotepad.exe, lrs, _         C:windows, SW_SHOW)ElseMsgBox There is no source code for this. _        It may be a System FileEnd If

Insert Inet Control (Name – Inet1)
Insert This line into your Module Declaration Section

Public Declare Function ShellExecute _       Lib shell32.dll Alias ShellExecuteA _       (ByVal hWnd As Long, _       ByVal lpOperation As String, _       ByVal lpFile As String, _       ByVal lpParameters As String, _       ByVal lpDirectory As String, _       ByVal nShowCmd As Long) As LongPublic Const SW_SHOW = 5Type SHELLEXECUTEINFO  cbSize As Long  fMask As Long  hWnd As Long  lpVerb As String  lpFile As String  lpParameters As String  lpDirectory As String  nShow As Long  hInstApp As Long  lpIDList As Long  lpClass As String  hkeyClass As Long  dwHotKey As Long  hIcon As Long  hProcess As LongEnd Type

Insert these coding into your click Event:

Dim rpo As StringOn Error Resume NextDim lrs As StringDim b() As Bytelrs = C:windowstemp.htmInet1.CancelInet1.Protocol = icHTTPInet1.URL = cboaddress.Textrpo = Dir$(C:Program FilesMicrosoft _      FrontPagebinfpeditor.exe)If rpo <>  ThenIf Inet1.URL <>  Thenb() = Inet1.OpenURL(, icByteArray)Open lrs For Binary Access Write As #1Put #1, , b()Close #1Dim retval As Longretval = ShellExecute(Me.hWnd, open, _         C:Program FilesMicrosoft _         FrontPagebinfpeditor.exe, lrs, _         C:MyProg, SW_MAXIMIZE)ElseMsgBox There is no source code for this. _       It may be a System File.End IfElseMsgBox Microsoft Front Page Software Not Found.End If

Insert Inet Control (Name – Inet1)
Insert This line into your Module Declaration Section

Public Declare Function ShellExecute _       Lib shell32.dll Alias ShellExecuteA _       (ByVal hWnd As Long, _       ByVal lpOperation As String, _       ByVal lpFile As String, _       ByVal lpParameters As String, _       ByVal lpDirectory As String, _       ByVal nShowCmd As Long) As LongPublic Const SW_SHOW = 5Type SHELLEXECUTEINFO  cbSize As Long  fMask As Long  hWnd As Long  lpVerb As String  lpFile As String  lpParameters As String  lpDirectory As String  nShow As Long  hInstApp As Long  lpIDList As Long  lpClass As String  hkeyClass As Long  dwHotKey As Long  hIcon As Long  hProcess As LongEnd Type

Insert these coding into your click Event:

On Error Resume NextDim rpo As StringDim lrs As StringDim b() As Bytelrs = C:Windowstemp.htmInet1.CancelInet1.Protocol = icHTTPInet1.URL = cboaddress.Textrpo = Dir$(C:Program FilesMicrosoft Visual Studio_               CommonIDEIDE98DEVENV.EXE)If rpo <>  ThenIf Inet1.URL <>  Thenb() = Inet1.OpenURL(, icByteArray)Open lrs For Binary Access Write As #1Put #1, , b()Close #1Dim retval As Longretval = ShellExecute(Me.hWnd, open, C:_         Program FilesMicrosoft Visual Studio_         CommonIDEIDE98DEVENV.EXE, lrs, _         C:MyProg, SW_MAXIMIZE)ElseMsgBox There is no source code for this. _       It may be a System File.End IfElseMsgBox Microsoft Visual Interdev Software _       Not FoundEnd If

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories