WebBrowser control-Description

Source: Internet
Author: User
Tags html header

Control File: system32 \ shdocvw. oca shdocvw. dll
Registration: regsvr32 shdocvw. dll
WebBrowser is a VB Control made by the IE kernel,
WebBrowser. Document is the automatic Object returned for the active Document. You can reference Microsoft HTML Object Library to view detailed attributes and methods.

The following illustration assumes that there is a WebBrowser control named Web1 in the form.
■ Method ==================================
▲Goback is equivalent to IE's "back" button, so that you can return
▲Goforward is equivalent to IE's "Forward" button, which enables you to move forward an item in the Current History List
▲Gohome is equivalent to the "Homepage" button of IE and connects to the user's default homepage.
▲Gosearch is equivalent to IE's "Search" button and connects to the user's default search page
▲Navigate connects to the specified URL and displays the webpage
▲Does Navigate2 play the same role as Navigate?
▲Refresh Refresh the current page
▲Refresh2 is the same as above, but the refresh level can be specified. The value of the specified refresh level comes from the RefreshConstants enumeration table,
This table is defined in ExDisp. h. Different values can be specified as follows:
REFRESH_NORMAL: Do not send HTTP pragma: no-cache hair to the server
REFRESH_IFEXPIRED can be refreshed only after the webpage expires.
REFRESH_CONTINUE is only used internally. Do not use in MSDN! Do not use
REFRESH_COMPLETELY sends requests containing the pragma: no-cache header to the server
▲Stop is equivalent to the "Stop" button of IE to Stop loading of the current page and its content.
■ Attributes ======================================================
▲Document is the automatic object returned for the active Document. If HTML is currently being displayed in Web1, the Document provides
The access path to the DHTML Object Model. The following is a detailed introduction.
▲Toplevelcontainer returns a Boolean value indicating whether IE is the top-level container of the Web1 control. true is returned if it is true.
▲Type: return the Type of the object loaded by the Web1 control. For example:
If the .doc file is used, Microsoft Word Document is returned.
▲Locationname returns a string containing the name of the currently displayed resource in Web1,
If the resource is a webpage, It is the title of the webpage;
If it is a file or folder, It is the name of the file or folder.
▲Locationurl: the URL of the resource currently being displayed in Web1 is returned.
▲Busy returns a Boolean value, indicating whether Web1 is currently loading the URL. If true is returned
You can use the stop method to cancel the ongoing access operation.
▲If the Object is set, a SHDocVwCtl. WebBrowser_V1 Object indicating the webpage is returned. See the following.
▲Menubar
▲Statusbar
▲Toolbar
▲Visible

■ Event ============================================
▲Beforenavigate2: triggered before the navigation occurs (before the webpage is opened), not triggered during refresh
▲Commandstatechange is triggered when the command activation status changes. It indicates when to activate or disable the Back and Forward menu items or buttons.
▲Documentcomplete: when the entire document is completed, it is not triggered when the page is refreshed.
▲Downloadbegin: this event is triggered when a download operation has started and refreshed.
▲Downloadcomplete triggered when a download operation is completed, refresh can also trigger this event
▲Triggered after NavigateComplete2 is complete and not triggered during refresh
▲Newwindow2 triggered before a new window pops up
You can set the ppDisp parameter in this event to display the object on the new webpage without the NewWindow event of SHDocVwCtl. WebBrowser_V1.
▲Onfullscreen is triggered when the FullScreen attribute changes. This event uses an input parameter of VARIENT_BOOL to indicate that IE is full.
Display Mode (VARIENT_TRUE) or normal display mode (VARIENT_FALSE)
▲Onmenubar is triggered when the MenuBar attribute is changed. It indicates that the parameter is of the VARIENT_BOOL type.
VARIANT_TRUE visible, VARIANT _ FALSE hidden
▲Onquit: whether the user closes the browser or the developer calls the Quit method, it will trigger when IE exits.
▲Onstatusbar is triggered when the StatusBar attribute is changed, indicating whether the status bar is visible.
▲Ontoolbar is triggered when the ToolBar attribute is changed to indicate whether the ToolBar is visible.
▲Triggered when OnVisible attribute is changed
▲Triggered when the status information of the StatusTextChange control changes.
▲Titlechange is triggered when the webpage title changes. The Text parameter is the new title, and the Web1.LocationName attribute is the old title.
■ SHDocVwCtl. WebBrowser_V1 object ======================
Add Private WithEvents Web_V1 As SHDocVwCtl. WebBrowser_V1 to the form declaration section.
Add: Set Web_V1 = Web1.Object to Form_Load.
In this way, Web_V1 will have the following events:
▲Newwindow is triggered before a new window is displayed.
If ppDisp is set as a New Display object in webdesknewwindow2, this event will not occur.
★Example 1: a pop-up page is displayed in the new window of the self-developed program:
Dim nForm As New formmain' FormMain is your form with the Web1 Control
Processed = true' to prevent the control from calling the IE pop-up window
NForm. Show
NForm. Web1.Navigate URL
★Example 2: display the webpage in the same window:
Processed = true' to prevent the control from calling the IE pop-up window
Web1.Navigate URL

■ Web1.Document object (HTMLDocument object) ======================
▲All (1) set, All tag objects included in the html document loaded to Web1: HTMLAreaElement
The index start point of the Set object is 0, and the total number is All. length.
You can use indexes to access objects, such as All (1)
You can also use the Html Header element name to access the object, for example, All ("body ")
All (0) is generally its own outerHTML. You can return the document code (view the source file) as follows ):
Text1.Text = Web1.Document. All (0). outerhtml
However, the previous statement is not reliable. Some codes starting with a Web page are not The All () set has most attributes of the HTMLAreaElement object, and some elements have special attributes.
Note that the sourceIndex attribute of an element is the number of the object in the Document. All () set.
▲Body body Element Object: IHTMLElement
▲Activeelement activity element: IHTMLElement
▲Anchors anchors collection: IHTMLElementCollection
▲Appendchild method: append sub-object (newChild As IHTMLDOMNode) As IHTMLDOMNode
▲Applets Java: IHTMLElementCollection
▲Attachevent method: event As String, pdisp As object) As Boolean
▲Attributes attribute object: object
▲Bgcolor background color: Variant
▲Childnodes subnode: object
▲Clear method: clear
▲Clonenode method: copy a node (fDeep As Boolean) As IHTMLDOMNode
▲Close method: close
▲Compatmode
▲Cookie Cache
▲Createattribute method: Create an attribute (bstrattrName As String) As IHTMLDOMAttribute
▲Createcomment method: Create a comment (bstrdata As String) As IHTMLDOMNode
▲Createdocumentfragment method: create a document clip () As IHTMLDocument2
▲Createdocumentfromurl: create a document from the URL (bstrUrl As String, bstrOptions As String) As IHTMLDocument2
▲Createelement method: Create an element (eTag As String) As IHTMLElement
▲Createeventobject method: Create an event object ([pvarEventObject]) As IHTMLEventObj
▲Createrenderstyle method: (v As String) As IHTMLRenderStyle
▲Createstylesheet method: Create a table ([bstrHref As String], [lIndex As Long =-1]) As IHTMLStyleSheet
▲Createtextnode method: Create a text node (text As String) As IHTMLDOMNode
▲Defacharcharset default character set?
▲Detachevent method: detach an event (event As String, pdisp As object)
▲Dir
▲Doctype document type: IHTMLDOMNode
▲Documentelement document element: IHTMLElement
▲Domain
▲Elementfrompoint method: the group to which the vertex belongs (x As Long, y As Long) As IHTMLElement
▲Embeds: IHTMLElementCollection
▲Execcommand method: Execute the command (container ID As String, [showUI As Boolean = False], [value]) As Boolean
▲Execcommandshowhelp: Help Command (container ID As String) As Boolean
▲Fgcolor Foreground: Variant
▲Filecreateddate: file creation date
▲File Modified Date: file modification Date
▲Filesize File Size
▲Fileupdateddate: file update date
▲Fireevent method: first event (bstrEventName As String, [pvarEventObject]) As Boolean
▲Firstchild: IHTMLDOMNode
▲Focus method:
▲Forms: IHTMLElementCollection
▲Frames Framework Structure: FramesCollection
▲Getelementbyid method: Obtain the specified ID element (v As String) As IHTMLElement
▲Getelementsbyname method: Obtain the specified Name Element Set (v As String) As IHTMLElementCollection
▲Getelementsbytagname: gets the specified TagName Element Set (v As String) As IHTMLElementCollection
▲Haschildnodes method:
▲Hasfocus method :() As Boolean
▲Images image set: IHTMLElementCollection

▲Implementation execution: IHTMLDOMImplementation
▲Insertbefore method: insert the front (newChild As IHTMLDOMNode, [refChild]) As IHTMLDOMNode
▲Lastchild
▲Modification on lastModified
▲Linkcolor link color
▲Alinkcolor A link color:
▲Vlinkcolor V Link color:
▲Links connection set: IHTMLElementCollection
▲Location location: HTMLLocation
▲Media
▲Mimetype
▲Nameprop
▲Namespaces namespace: object
▲Nextsibling: Next same object
▲Nodename
▲Nodetype
▲Nodevalue
▲Open method: open ([url As String = "text/html"], [name], [features], [replace]) As object
▲Ownerdocument owner document: object
▲Parentnode parent node: IHTMLDOMNode
▲Parentwindow parent window: IHTMLWindow2
▲Plugins plug-in set? : IHTMLElementCollection
▲Previussibling: IHTMLDOMNode
▲Protocol
▲Querycommandenabled: query whether the command can be executed (upload ID As String) As Boolean
▲Querycommandindeterm method: query command? (Upload ID As String) As Boolean
▲Querycommandstate method: query command status (pipeline ID As String) As Boolean
▲Querycommandsupported method: query command support (partition ID As String) As String
▲Querycommandtext method: query command text (pipeline ID As String) As Boolean
▲Querycommandvalue method: query command value (sequential ID As String)
▲Readystate
▲Recalc method: ([fForce As Boolean = False])
▲Referrer
▲Releasecapture method:
▲Removechild method:
▲Removenode method:
▲Replacechild method:
▲Replacenode method: replacement As IHTMLDOMNode
▲Scripts script collection: IHTMLElementCollection
▲Security: String
▲Selection selected object set: IHTMLSelectionObject
▲Stylesheets form: HTMLStyleSheetsCollection
▲Swapnode method: otherNode As IHTMLDOMNode
▲Title
▲Tostring method:
▲Url
▲Urlunencoded
▲Write method: (ParamArray psarray () As Variant)
▲Writeln method :( ParamArray psarray () As Variant)
▲Onstop is both an attribute and an event
▲Common attributes and events
■ Common attributes and events: Both attributes and events. ============================
▲Onactivate onactivate
▲Onafterupdate after onafterupdate
▲Onbeforeactivate before onbeforeactivate is activated
▲Before copying onbeforecopy
▲Before onbeforecut onBeforeCut is cut
▲Before onbeforedeactivate onBeforeDeactivate is invalid
▲Onbeforeeditfocus before obtaining the edit focus
▲Onbeforepaste before pasting onbeforepaste
▲Onbeforeupdate before onbeforeupdate
▲Onblur onblur fuzzy
▲Oncellchange oncellchange unit change
▲Onclick onclick
▲Oncontextmenu oncontextmenu context menu
▲Oncontrolselect oncontrolselect control selected
▲Oncopy oncopy
▲Oncut oncut Cut
▲Ondataavailable ondataavailable useful data
▲Ondatasetchanged ondatasetchanged data settings
▲Ondatasetcomplete ondatasetcomplete data is set
▲Ondblclick ondblclick double-click
▲Ondeactivate ondeactivate becomes inactive
▲Ondrag ondrag
▲Ondragend ondragend
▲Ondragenter ondragenter
▲Ondragleave ondragleave
▲Ondragover ondragover
▲Ondragstart ondragstart
▲Ondrop ondrop
▲Onerrorupdate onerrorupdate Error
▲Onfilterchange onfilterchange filter change
▲Onfocus onfocus
▲Onfocusin onfocusin focus entry
▲Onfocusout onfocusout focus exit
▲Onhelp onhelp
▲Onkeydown onkeydown
▲Onkeypress onkeypress
▲Onkeyup onkeyup
▲Onlayoutcomplete onlayoutcomplete layout completed
▲Onlosecapture onlosecapture lost capture
▲Onmousedown onmousedown
▲Onmouseenter onmouseenter
▲Onmouseleave onmouseleave
▲Onmousemove onmousemove
▲Onmouseout onmouseout
▲Onmouseover onmouseover
▲Onmouseup onmouseup
▲Onmousewheel onmousewheel
▲Onmove onmove
▲Onmoveend onmoveend
▲Onmovestart onmovestart
▲Onpage onpage
▲Onpaste onpaste Paste
▲Onpropertychange onpropertychange
▲Onreadystatechange onSeadyStateChange preparation status change
▲Onresize onresize
▲Onresizeend onresizeend
▲Onresizestart onresizestart
▲Onrowenter onrowenter
▲Onrowexit onrowexit
▲Onrowsdelete onrowsdelete
▲Onrowsinserted onrowsinserted
▲Onscroll onscroll
▲Onselectstart onselectstart
-------
■ HTMLDivElement object: Attributes specific to the div element ======================
▲Align: String
▲Dataworkflow data fluid: String
▲Dataformatas Data Format: String
▲Datasrc data Src: String
▲Nowrap
■ HTMLAreaElement object: Attributes common to most of the region elements ======================
An HTMLAreaElement can contain multiple HTMLAreaElement objects, which are accessed using the all () set.
▲Number of the sourceIndex object in the Document. All () Set
▲Accesskey String: access key
▲Addbehavior method: Add behavior (bstrUrl As String, [pvarFactory]) As Long
▲Addfilter method: Add a filter (pUnk As Unknown)
▲All [HTMLAreaElement]
▲Alt
▲Appendchild [HTMLAreaElement]
▲Applyelement method: apply As IHTMLElement, where As String) As IHTMLElement
▲Attachevent method: event As String, pdisp As object) As Boolean
▲Attributes [HTMLAreaElement]
▲Behaviorurns: object
▲Blur method: Fuzzy
▲Can canHaveChildren have sub-objects?
▲Can canHaveHTML own HTML?
▲Childnodes subnode: object
▲Children is a sub-Object
▲Classname Class Name
▲Clearattributes method: Clear attributes
▲Click method: click
▲Clientheight internal height?
▲Clientleft
▲Clienttop
▲Clientwidth
▲Clonenode method: Clone node (fDeep As Boolean) As IHTMLDOMNode
▲Componentfrompoint method: point group (x As Long, y As Long) As String
▲Contains method: contains (pChild As IHTMLElement) As Boolean
▲Contenteditable
▲Coords
▲Createcontrolrange method: Create a control Mountain (row and column) As object
▲Current currentStyle style: IHTMLCurrentStyle
▲Detachevent method: detach an event (event As String, pdisp As object)
▲Dir
▲Disabled unavailable
▲Document object: object
▲Doscroll method ([component])
▲Dragdrop method: Drag and Drop
▲Filters filter: IHTMLFiltersCollection
▲Fireevent method FireEvent (bstrEventName As String, [pvarEventObject]) As Boolean
▲Firstchild: IHTMLDOMNode
▲Focus Method
▲Getadjacenttext method: obtain near text (where As String) As String
▲Getattribute method: Get attributes (strAttributeName As String, [lFlags As Long])
▲Getattributenode method: Get the attribute node (bstrName As String) As ihtmldomattri
▲Getboundingclientrect method: Obtain the rectangle in the internal range () As IHTMLRect
▲Getclientrects method: Obtain the delegate rectangle () As IHTMLRectCollection
▲Getelementsbytagname [HTMLAreaElement]
▲Getexpression method: Get the expression (propname As String)
▲Haschildnodes [HTMLAreaElement]
▲Useless hash Information
▲Hidefocus
▲Host host
▲Hostname Host Name
▲Href default attributes
▲Id string
▲Html code in the innerHTML Element
▲The text in innerText can be displayed on the webpage.
▲Insertadjacentelement method: insert near elements (where As String, insertedElement As IHTMLElement) As IHTMLElement
▲Insertadjacenthtml method :( where As String, html As String)
▲Insertadjacenttext method :( where As String, text As String)
▲Insertbefore method: (newChild As IHTMLDOMNode, [refChild]) As IHTMLDOMNode
▲Iscontenteditable
▲Isdisabled
▲Ismultiline
▲Istextedit
▲Lang
▲Language
▲Lastchild
▲Mergeattributes method: Merge attributes (mergeThis As IHTMLElement, [pvarFlags])
▲Objects of the same level under nextSibling
▲Nodename
▲Nodetype
▲Nodevalue
▲Nohref
▲Normalize method: Normalization
▲Offsetheight offset (indent) Height
▲Offsetleft
▲Offsetparent
▲Offsettop
▲Offsetwidth

▲Outerhtml contains the element and internal html code
▲Outertext
▲Ownerdocument
▲Parentelement
▲Parentnode
▲Parenttextedit
▲Pathname
▲Port
▲Previussibling
▲Protocol
▲Readystate
▲Recordnumber
▲Releasecapture method: Release capture
▲Removeattribute method: Remove attributes
▲Removeattributenode Method
▲Removebehavior method: delete action
▲Removechild Method
▲Removeexpression Method
▲Removefilter Method
▲Removenode Method
▲Replaceadjacenttext: replace near text
▲Replacechild Method
▲Replacenode Method
▲Runtimestyle running mode: IHTMLStyle
▲Scopename range name
▲Scrollheight
▲Scrollintoview Method
▲Scrollleft
▲Scrolltop
▲Scrollwidth
▲Search
▲Setactive Method
▲Setattribute Method
▲Setattributenode Method
▲Setcapture Method
▲Setexpression Method
▲Shape
▲Style
▲Swapnode method: swapNode
▲Tabindex
▲Tagname
▲Tagurn label Tank
▲Target
▲Title
▲Tostring
■ Web1 application example
▲After the webpage is added, run the link at a certain layer. Of course, you must first know the TagName of the link at this layer:
WebBrowser1.Document. getElementsByname ("TagName"). click.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.