Advertisement
ASP_Volume2 Custom Controls/ Forms/ Menus #29714

WebBrowser Commands

This is a list of some basic WebBrowser Commands and a few advanced ones.

AI

Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Codice sorgente
original-source
'Go to the previous webpage
WebBrowser1.GoBack
'Go to the present webpage
WebBrowser1.GoForward
'Go to the default IE home
WebBrowser1.GoHome
'Go to the default search page
WebBrowser1.GoSearch
'Refresh the current webpage
WebBrowser1.Refresh
'Navigate to a webpage
WebBrowser1.Navigate "www.YourSite.com"
  
'Printing:
WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
'Saving a webpage:
WebBrowser1.ExecWB OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER
'Open a webpage file on located on your computer:
On Error GoTo fileOpenErr
CommonDialog1.CancelError = True
CommonDialog1.flags = &H4& Or &H100& Or cdlOFNPathMustExist Or cdlOFNFileMustExist
CommonDialog1.DialogTitle = "Select File To Open"
CommonDialog1.Filter = "HTM (*.htm)|*.htm|Txt Files (*.txt)|*.txt|Jpg Files (*.jpg)|*.jpg|Gif Files (*.gif)|*.gif|All Files (*.*)|*.*"
CommonDialog1.ShowOpen
webbrowser1.Navigate CommonDialog1.FileName
fileOpenErr:
Exit Sub
'Open a new web browser using your program and not IE:
Dim NewBrowser as Form1
NewBrowser.Show
NewBrowser.Caption = "MyBrowser"
'Load IE Preferences:
Dim dblReturn As Double
dblReturn = Shell("rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,0", 5)
'An advanced Stop:
If webbrowser1.Busy Then
webbrowser1.Stop
webbrowser1.GoBack
End If
Commenti originali (3)
Recuperato da Wayback Machine