|
项目描述: |
Sometimes, when we are using the IE Browser Control inside of a C++ application, we need to access the HTML elements. We can do it by using standard COM objects such as IWebBrowser2, IHTMLDocument2, and so forth. By doing this, we easily can implement features such as click button, click anchor, get input string, get HTML text, and so on. Unfortunately, Microsoft did not provide similar objects for JavaScript. In any case, it is possible to make a control for the JavaScript object inside an HTML page by using a traditional COM approach. This article describes the class CWebPage that allows you to do it and a technique to call a JavaScript function from C++ code.
有时,当我们在一人C++程序中使用IE Browser Control控件时,我们需要访问HTML 元素。我们可以通过共享COM对象,如IWebBrowser2, IHTMLDocument2 等等,来实现。这样,我们可以容易地实现点击按钮、超链接功能,获取输入的字符串,得到HTML 文本,等等。不幸的是,Microsoft 没有提供JavaScript的对应模型。在这种情况下,我们可以使用传统的COM方法为HTML 中的JavaScript 生成一个控件。这个项目中的CWebPage 类就可以让你完成这一功能,演示了从C++代码中调用JavaScript 的技术。
来源: http://www.codeguru.com/ieprogram/JSCalls.html |
类别: |
|
发布者:
cbd002
|
|
最新发布源码包 |
软件包 |
版本号 |
日期 |
本地下载 |
JSCalls |
 1.0  |
2004-04-19 |
下载 |
|
|