![](/img/trans.png)
[英]Why IHTMLDocument2 is not equal to IHTMLDocument2.body.document?
[英]IHTMLDocument2.write()
我正在編寫一個檢查we頁面上某些數據的應用程序,因此我嘗試將整個html寫入IHTMLDocument2中,但是該程序鎖定了write()方法。 我的意思是它不會停止,只會鎖定。 這是代碼:
result = doHTTP_Request(uri, data, _userA, cType, "POST", cookie);
String _res = (String)result[0];
cookie = (CookieContainer)result[1];
IHTMLDocument2 doc = new HTMLDocumentClass();
doc.write(_res);
我知道這有點晚了,但是您可以嘗試以下操作:
IHTMLDocument2 doc = new HTMLDocument() as IHTMLDocument2;
DisableDebuggersAndNotification(true);
doc.write(_res);
DisableDebuggersAndNotification(false);
private void DisableDebuggersAndNotification(bool setValue)
{
string val = null;
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Internet Explorer\\Main", true))
{
if (key != null)
{
val = (setValue) ? "yes" : "no";
key.SetValue("DisableScriptDebuggerIE", val, RegistryValueKind.String);
val = (setValue) ? "yes" : "no";
key.SetValue("Disable Script Debugger", val, RegistryValueKind.String);
val = (!setValue) ? "yes" : "no";
key.SetValue("Error Dlg Displayed On Every Error", val, RegistryValueKind.String);
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.