0

为什么以下 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?
4

1 回答 1

0

对我来说,最可能的解释是为同一事物创建了不同的包装对象。谁知道 MSHTML 如何在内部进行管理。只要((pDisp as IWebBrowser2).Document as IHTMLDocument3).documentElement as IUnknown == (((pDisp as IWebBrowser2).Document as IHTMLDocument2).body.document as IHTMLDocument3).documentElement as IUnknown世界秩序井​​然;)

于 2011-10-18T14:44:49.547 回答