为什么IHTMLDocument2不等于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世界是有序的;)

相关内容

  • 没有找到相关文章

最新更新