- 浏览: 1001585 次
文章分类
最新评论
-
l67721363:
感谢分享,要是有各个函数性能比较就好了。
SQL优化 数据库优化 -
hanmiao:
此图片来自QQ空间,未经允许不可引用。
Hacking QQ空间
IHTMLDocument2 interface
Gets information about the document, and examines and modifies the HTML elements and text in the document.
Members
The IHTMLDocument2 interface inherits from the IDispatch interface. IHTMLDocument2 also has these types of members:
Methods
The IHTMLDocument2 interface has these methods.
IHTMLControlRange::execCommand |
Executes a command on the current document, current selection, or the given range. |
IHTMLControlRange::execCommandShowHelp |
Displays help information for the given command identifier. |
IHTMLControlRange::queryCommandEnabled |
Returns a Boolean value that indicates whether a specified command can be successfully executed using IHTMLControlRange::execCommand, given the current state of the document. |
IHTMLControlRange::queryCommandIndeterm |
Returns a Boolean value that indicates whether the specified command is in the indeterminate state. |
IHTMLControlRange::queryCommandState |
Returns a Boolean value that indicates the current state of the command. |
IHTMLControlRange::queryCommandSupported |
Returns a Boolean value that indicates whether the current command is supported on the current range. |
IHTMLControlRange::queryCommandValue |
Returns the current value of the document, range, or current selection for the given command. |
IHTMLDialog::toString |
Retrieves a string representation of the object. |
IHTMLDocument2::clear |
Not supported. |
IHTMLDocument2::close |
Closes an output stream and forces the sent data to display. |
IHTMLDocument2::createElement |
Creates an instance of the element for the specified tag. |
IHTMLDocument2::createStyleSheet |
Creates a style sheet for the document. |
IHTMLDocument2::elementFromPoint |
Returns the element for the specified x coordinate and the specified y coordinate. |
IHTMLDocument2::open |
Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the IHTMLDocument2::write method and the IHTMLDocument2::writeln method. |
IHTMLDocument2::queryCommandText |
Retrieves the string associated with a command. |
IHTMLDocument2::write |
Writes one or more HTML expressions to a document in the specified window. |
IHTMLDocument2::writeln |
Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. |
Properties
The IHTMLDocument2 interface has these properties.
IHTMLAnchorElement::mimeType |
Read-only |
Retrieves the MIME type for the file. |
Read/write |
Sets or retrieves the protocol portion of a URL. |
|
Read-only |
Gets the object that has the focus when the parent document has focus. |
|
Read/write |
Sets or gets the color of all active links in the document. |
|
IHTMLDocument2::all |
Read-only |
Gets an interface pointer to a zero-based collection of all the elements in an HTML document. |
IHTMLDocument2::anchors |
Read-only |
Gets an interface pointer to a zero-based collection of all the a objects in an HTML document. |
IHTMLDocument2::applets |
Read-only |
Gets an interface pointer to a zero-based collection of all of the applet objects in an HTML document. |
Read/write |
Deprecated. Sets or retrieves a value that indicates the background color behind the object. |
|
Read-only |
Gets an interface pointer to the document body object. |
|
Read/write |
Sets the character set used to encode the object. |
|
Read/write |
Sets or gets the string value of a cookie. |
|
Read/write |
Gets the default character set from the current regional language settings. |
|
Read/write |
Sets or gets a value that indicates whether the document can be edited. |
|
Read/write |
Sets or gets the security domain of the document. |
|
IHTMLDocument2::embeds |
Read-only |
Gets an interface pointer to a zero-based collection of all of the embed objects in an HTML document. |
Read/write |
Sets a value indicating whether arbitrary variables can be created within the object. |
|
Read/write |
Sets or gets the foreground (text) color of the document. |
|
Read-only |
Retrieves the date the file was created. |
|
Read-only |
Retrieves the date the file was last modified. |
|
Read-only |
Retrieves the file size. |
|
IHTMLDocument2::forms |
Read-only |
Gets an interface pointer to a zero-based collection of all the form objects in an HTML document. |
IHTMLDocument2::frames |
Read-only |
Gets an interface pointer to a zero-based collection of all of the frame objects in an HTML document, if the document contains the frameSet object. Gets an interface pointer to a zero-based collection of all of the iframe objects in the document, if the document contains the body object. |
IHTMLDocument2::images |
Read-only |
Gets a pointer to the IHTMLElementCollection interface of the zero-based collection of all of the images in an HTML document. The images are in the same order as they appear in the document. |
Read-only |
Gets the date that the document was last modified, if the document supplies one. |
|
Read/write |
Sets or gets the color of the document links. |
|
IHTMLDocument2::links |
Read-only |
Gets an interface pointer to a zero-based collection of all of the link objects and the area objects in an HTML document. |
IHTMLDocument2::nameProp |
Read-only |
Gets the title of the document file. |
IHTMLDocument2::onreadystatechange |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onreadystatechange event. |
Read-only |
Gets a reference to the container object of the window. |
|
IHTMLDocument2::plugins |
Read-only |
Gets an interface pointer to a zero-based collection of all of the embed objects in an HTML document. |
Read-only |
Gets the URL of the location that referred the user to the current document. |
|
IHTMLDocument2::scripts |
Read-only |
Gets an interface pointer to a zero-based collection of all of the script objects in an HTML document. |
IHTMLDocument2::security |
Read-only |
Not implemented. |
IHTMLDocument2::selection |
Read-only |
Gets an interface pointer to an object representing the active selection. The active selection can be an insertion point, a highlighted block of text, or another element in the document that the user or a script can carry out an action on. |
IHTMLDocument2::styleSheets |
Read-only |
Gets an interface pointer to a zero-based collection of the style sheet objects exposed from the document object. Each style sheet object represents an individual style sheet that is defined for the document. |
IHTMLDocument2::title |
Read/write |
Sets or gets the title of the document. |
Read/write |
Sets or gets the URL for the current document. |
|
Read/write |
Sets or gets the color of the links that the user has visited. |
|
IHTMLElement::onafterupdate |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onafterupdate event. |
IHTMLElement::onbeforeupdate |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onbeforeupdate event. |
IHTMLElement::onclick |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onclick event. |
IHTMLElement::ondblclick |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondblclick event. |
IHTMLElement::ondragstart |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::ondragstart event. |
IHTMLElement::onerrorupdate |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onerrorupdate event. |
IHTMLElement::onhelp |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onhelp event. |
IHTMLElement::onkeydown |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onkeydown event. |
IHTMLElement::onkeypress |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onkeypress event. |
IHTMLElement::onkeyup |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onkeyup event. |
IHTMLElement::onmousedown |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmousedown event. |
IHTMLElement::onmousemove |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmousemove event. |
IHTMLElement::onmouseout |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmouseout event. |
IHTMLElement::onmouseover |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmouseover event. |
IHTMLElement::onmouseup |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onmouseup event. |
IHTMLElement::onrowenter |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onrowenter event. |
IHTMLElement::onrowexit |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onrowexit event. |
IHTMLElement::onselectstart |
Read/write |
Sets or retrieves a pointer to the event handler function associated with the HTMLFrameSiteEvents::onselectstart event. |
Read-only |
Retrieves the date the file was last updated. |
|
Read-only |
Retrieves a value that indicates the current state of the object. |
|
IHTMLWindow2::location |
Read-only |
Retrieves an interface pointer to a location object. |
Remarks
Typically, every window object has a corresponding document object that you can get by calling the QueryInterface method with the IID_IHTMLDocument or IID_IHTMLDocument2 interface identifiers. Windows that contain HTML documents always have valid document objects; windows that contain documents in other formats might not have valid document objects.
In general, before you attempt to get the document object for a window that is not the current window, make sure that the source file associated with that window is an HTML document file or a file that can be represented as an HTML document, for example, a text file.
This interface may also be referred to in code as IOmDocument2.
Requirements
Windows XP |
Windows 2000 Server |
|
|
|
相关推荐
标题中的“通过窗口句柄获得IWebBrowser2和IHTMLDocument2接口”涉及到的是在Windows应用程序开发中,如何从一个窗口句柄(HWND)获取到IE浏览器组件的接口,以便进行更深入的网页操作和控制。这个过程通常用于自动...
这里我们将深入探讨如何在C#中获取`IHTMLDocument2`接口,并创建一个链接(a标签)的单击事件。 `IHTMLDocument2`是Microsoft的ActiveX组件,它代表了一个HTML文档对象模型(DOM)。在C#中,我们可以使用`System....
此外,`IHTMLDocument2`还支持事件处理,如通过`attachEvent`或`detachEvent`来添加或移除事件监听器。 在描述中提到的"IHTMLDocument2问题代码"可能指的是开发者在使用这个接口时遇到的问题。这可能包括但不限于...
之前为这个头疼好久... 没办法获取showModalDialog对话框中网页的内容... ...然后传入IHTMLDocument2对象的引用。源代码在此供大家参考 环境:VC++ 2008 注: GCC不可编译。原因:mshtml.h文件编译错误
用WPF写的一个小程序,以网易Yeah邮箱为例,利用IHTMLDocument2类实现用户名和密码自动提交以登陆邮箱。 注:需要引用引入Microsoft.mshtml.dll链接库 地址是C:\Program Files\Microsoft.NET\Primary Interop ...
2. **IHTMLDocument3接口**:掌握接口提供的各种方法,如`write()`, `execCommand()`, `getElementById()`等,以便于对HTML文档进行操作。 3. **COM组件**:理解COM组件的工作原理,包括接口、类ID(CLSID)、接口ID...
本教程将详细讲解如何利用Windows编程接口(API)和`WebBrowser`控件来实现这一目标,特别是通过`IHTMLDocument2`接口获取网页密码和处理超链接。 `WebBrowser`控件是.NET Framework和ActiveX技术中的一个重要组件...
// Step 4: Get IHTMLDocument2 interface // ... // Step 5: Get HTML source code BSTR htmlSource; if (SUCCEEDED(doc2->get_html(&htmlSource))) { // Process the HTML source wprintf(L...
Python操作IHTMLDocument2用于自动化测试软件测试有些软件的界面采用Win32窗口嵌套一个IE控件,用Spy++只能识别出一个InternetExplorer_Server控件。常用的几个API函数无法取到IE控件里面的内容,更无法对里面的控件...
DOM开发,用VC6获取网页WEBBROWSER2,IHTMLDOCUMENT元素
在这个过程中,关键的技术是利用了ActiveX技术,特别是对IHTMLDOCUMENT2接口的运用。 IHTMLDOCUMENT2是Internet Explorer浏览器对象模型的一部分,它提供了对HTML文档的全面访问,包括元素、属性和方法。通过这个...
(WebBrowser1.Document as IHTMLDocument2).body.style.borderStyle := 'none'; // 设置边框样式为无 end; end; ``` #### 2.2 隐藏滚动条 隐藏滚动条同样可以通过设置`style`属性来实现: ```delphi procedure ...
在IE8与IE6的编程方法不一样,在网上找了很长时间,都找不到IE8怎么编程,在IE8中,如果用IE6的方法得到的IHtmlDocument是无效的,不能操作,得使用另一种方法来编程,请看例子吧,例子为本人在工作中总结出来的,像IE8中的...
一旦有了`IHTMLDocument2`接口,我们就可以通过它来获取JavaScript对象。这需要查询`IDispatch`接口,因为JavaScript对象通常以`IDispatch`的形式存在: ```cpp CComPtr<IDispatch> spScript; m_spDoc->get_Script...
每个网页可以通过IWebBrowser2/IHTMLWindow2接口装载在浏览器中,这些接口可以包含一个或多个帧(frame),每个帧又是一个IHTMLWindow2容器,装载各自的IHTMLDocument2文档。如果存在嵌套的帧,那么需要递归遍历来...
首先,我们需要包含必要的头文件和库,如`#import <mshtml.tlb>`,这将引入MSHTML的类型库,使我们能够使用诸如`IHTMLDocument2`等接口。然后,通过CoCreateInstance函数实例化`CLSID_HTMLDocument`,就可以获取到一...
Doc:=wb1.Document as IHTMLDocument2; //wb1.OleObject.document.getElementsByTagName('input').item(7).click; group:=(Doc.all.item('dict_main',varEmpty) as IHTMLElement2).getElementsByTagName('div');
- 可以通过 `IHTMLDocument2::write` 方法将字符串写入文档,或者使用 `IHTMLDocument2::open` 和 `IHTMLDocument2::close` 方法来打开和关闭文档流。 ```cpp pDoc->open(); pDoc->write(csWholeFile); pDoc->...
- 在`SetSite`方法中,使用`IServiceProvider`查询`IWebBrowser2`,然后调用`IWebBrowser2::Document`获取当前的`IDispatch*`,这通常是`IHtmlDocument2`的指针。 3. **事件响应** - 对于`IHtmlDocument2`,我们...
本文将深入探讨如何使用C++与Internet Explorer(IE)浏览器接口(ihtmldocument2)结合Tesseract OCR进行验证码识别,并将识别结果自动填充到验证码输入框。 首先,`ihtmldocument2`是IE浏览器提供的一种COM接口,...