为什么下面的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
世界是有序的;)