簡體   English   中英

為什么 IHTMLDocument2 不等於 IHTMLDocument2.body.document?

[英]Why IHTMLDocument2 is not equal to IHTMLDocument2.body.document?

為什么以下 doc2 與 doc22 不同?

IHTMLDocument2 doc2 = (pDisp as IWebBrowser2).Document as IHTMLDocument2;
IHTMLDocument2 doc22 = doc2.body.document as IHTMLDocument2;
bool isequal = Marshal.GetIUnknownForObject(doc2) == Marshal.GetIUnknownForObject(doc22);
//Here, isequal is false. Why?

對我來說,最可能的解釋是為同一事物創建了不同的包裝對象。 誰知道 MSHTML 如何在內部進行管理。 只要((pDisp as IWebBrowser2).Document as IHTMLDocument3).documentElement as IUnknown == (((pDisp as IWebBrowser2).Document as IHTMLDocument2).body.document as IHTMLDocument3).documentElement as IUnknown世界是有序的;)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM