- 1、本文档共21页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
WebBrowser组件和MSHTML 在Delphi中的使用(国外英文资料)
WebBrowser组件和MSHTML 在Delphi中的使用(国外英文资料)
WebBrowser components and MSHTML in Delphi
Due to project requirement, the recent studies about the WebBrowser component and MSHTML in the use of Delphi, adjusted the results of this period of time study, write down a convenient you consult, 2 also can deepen the memory of my own. Hope to be able to help you... ... At the same time, if there is a better way to deal with it or I didnt mention it, please let me know, lets make progress... ... And part of that is the information I collected from the Internet, thanks to the brothers... ...
MSHTML encapsulates elements in the HTML page as IHTMLInputElement, IHTMLInputButtonElement, IHTMLInputTextElement, IHTMLTextAreaElement, IHTMLTitleElement, IHTMLFormElement, etc.
In the program can be provided by MSHTML IHTMLDocument2 interface to get the whole Document object, IHTMLElementCollection interface to get a collection of all elements on the page, by using the approach of the interface Item can be a component, and then set and read the component of attribute values.
Here are some examples of common functionality.
Open a page:
The ExtractFilePath (application.exename) + Template/login.html); / / specify a file
The Web. ( about: blank ); / / page
Remove the Value attribute Value of an HtmlElement in the page:
Function GetValueByElementName (web: TWebBrowser; elementName: string; index: integer) : string;
The begin
Result: (web. Document as IHTMLDocument2)
The IHTMLElementCollection).item (elementName, index) as IHTMLInputElement
). The value
The end;
Set the Value attribute to the HtmlElement
Procedure SetValueTextAreaName (web: TWebBrowser; elementName, value: string; index: integer);
The begin
(web. Document as IHTMLDocument2)
The IHTMLElementCollection).item (elementName, index) as IHTMLTextAreaElement
Value: = value:
The end;
Determine if the results are successful
Because Web applications if the error is generally adopt the way of error page is presented to the end user, so we can
文档评论(0)