用API获得Internet Explorer_Server类的HTML
生活随笔
收集整理的這篇文章主要介紹了
用API获得Internet Explorer_Server类的HTML
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
首先要找到含有Internet Explorer_Server類句柄,
HTMLDocumentClass? result = (HTMLDocumentClass)documentFromDOM(hWnd.ToInt32());
result.activeElement.innerHTML就得到所有HTML
?
private?static?IHTMLDocument2?documentFromDOM(int?hWnd)
????????{
?????????????IHTMLDocument2?document=null;
????????????int?lRes=0;
????????????int?lngMsg?=?NativeMethods.RegisterWindowMessage("WM_HTML_GETOBJECT");
????????????Guid?IID_IHTMLDocument?=?new?Guid("626FC520-A41E-11CF-A731-00A0C9082637");
????????????if?(lngMsg?!=?0)
????????????{
????????????????NativeMethods.SendMessageTimeout(hWnd,?lngMsg,?0,?0,?NativeMethods.SMTO_ABORTIFHUNG,?1000,?ref?lRes);
????????????????if?(!(bool)(lRes?==?0))
????????????????{
????????????????????int?hr?=?NativeMethods.ObjectFromLresult(lRes,?ref?IID_IHTMLDocument,?0,?ref?document);
????????????????????if?((bool)(document?==?null))
????????????????????{
????????????????????????MessageBox.Show("No?IHTMLDocument?Found!",?"Warning");
????????????????????}
????????????????}
????????????}
????????????return?document;
????????}
?
?
轉載于:https://www.cnblogs.com/hubj/archive/2010/05/15/1735947.html
總結
以上是生活随笔為你收集整理的用API获得Internet Explorer_Server类的HTML的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 手动创建数据库实例全攻略7:UNDO
- 下一篇: 桃花,梨花,油菜花