国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
MSHTML Reference

About MSHTML

Internet Development Index

All interfaces for accessing the Dynamic HTML (DHTML) Object Model are based on IDispatch and are the basis of access to the object model that is also used by scripts. It is therefore important that anyone using the interfaces to manipulate the object model also be familiar with the structure and functionality defined in the Introduction to Dynamic HTML overview and in the object model references included in MSHTML.

The Interfaces and Scripting Objects section of the MSHTML Reference shows how objects within the DHTML Object Model map to the interfaces. For example, using this map, you can see that the IHTMLDocument2 interface maps to the document object. Further examination of the interface shows how the properties of the document object are available through get_ and put_ methods. The object‘s methods map to methods available in the interface, and events can be hooked up using standard OLE Automation connection points.

Examples of how to use the object model interfaces are demonstrated in the Colbtn, Driller, and WalkAll samples on the Colbtn Sample Source Page, the Driller Sample Source Page and the WalkAll Sample Source Page.

Recommendations for Using the Interfaces

Usually, anything that can be done using script within the document can also be performed using the interfaces to manipulate the object model. It is therefore recommended that before writing code to use the object model interfaces, developers should prototype the functionality using script within an HTML document.

The following HTML example shows how to navigate the all collection of the document and obtain the tag name of each element in the document using script. The equivalent Microsoft Visual C++ code is demonstrated in the Driller and WalkAll samples on the Driller Sample Source Page and the WalkAll Sample Source Page using the object model interfaces.

Show Example

Obtaining the Document Interface

To start using the object model interfaces, obtain the IHTMLDocument2 interface for the document. Once you have this interface, you can access all the elements within the document. How the document interface is obtained depends on how your application is being implemented. Each of the following scenarios requires that the document interface be obtained in a different manner.

  • When hosting an MSHTML object.
  • When hosting an instance of the WebBrowser Control.
  • From a Microsoft ActiveX control contained in a page.

Obtaining the Document Interface when Hosting MSHTML

When hosting an MSHTML object, create the object using CoCreateInstance. Once the object is created, you can call its QueryInterface method, requesting IID_IHTMLDocument2. The WalkAll sample on the WalkAll Sample Source Page demonstrates how to do this.

Obtaining the Document Interface when Hosting the WebBrowser Control

When hosting the WebBrowser Control, perform the following steps to obtain the document pointer:

  1. Call IWebBrowser2::get_Document to obtain the document‘s IDispatch pointer.
  2. Call QueryInterface on the IDispatch pointer obtained in the previous step, requesting IID_IHTMLDocument2.

Obtaining the Document Interface from an ActiveX Control

The Accessing Dynamic HTML section of the ActiveX Controls documentation explains how to obtain the document interface from an ActiveX control.

Using the Document Interface

Once you have obtained the document interface, you can use any of the IHTMLDocument2 interfaces to obtain or modify the document‘s properties. This will most commonly involve getting some of the IHTMLElementCollection interfaces for the different element collections contained in the document.

A very common collection is the all collection. The all collection is obtained using the IHTMLDocument2::all method. This method returns an IHTMLElementCollection interface that contains all the elements in the document. You can then enumerate the elements using the IHTMLElementCollection::item method. The IHTMLElementCollection::item method provides you with an IDispatch pointer on which you can call QueryInterface, requesting IID_IHTMLElement. This will give you an IHTMLElement interface pointer that you can use to obtain or set information for the individual element.

Most elements provide an interface for working with that specific element. These element-specific interface names take the format of IHTMLXXXXElement, where XXXX is the name of the element. To obtain the element-specific interface, call QueryInterface on the IHTMLElement interface, requesting the element-specific interface that is desired. For example, the img element provides an IHTMLImgElement interface that can be used to work with the img element specifically. For a list of the available element-specific interfaces, see the interface listing in Interfaces and Scripting Objects.

Related Topics

 

 

 

MSHTML Reference

Internet Development Index


This section contains links to reference articles for MSHTML.

Interfaces and Scripting ObjectsLists the interfaces and corresponding scripting objects.
MSHTML Event DispInterfacesLists the MSHTML C++ events.
MSHTML FunctionsLists the MSHTML functions.
MSHTML StructuresLists the MSHTML structures.
MSHTML EnumerationsLists the MSHTML enumerations.
MSHTML Command IdentifiersLists the CGID_MSHTML command identifiers.

 

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
計(jì)算機(jī)詞匯 中英對(duì)照
script - HTML元素
如何用mshtml獲得Javascript中function的返回值[mshtml]
[C#]兩個(gè)分析HTML網(wǎng)頁(yè)的方法[轉(zhuǎn)]
mshtml and frames/iframes
FI Enhancement Technique – How
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服