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.
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.
比如:
IDispathaaa aaa;
为aaa赋值;
aaa->dosomthing();