IHTMLDocument2.write()

本文关键字:write IHTMLDocument2 | 更新日期: 2023-09-27 18:26:07

我正在编写一个应用程序,该应用程序检查we页面上的一些数据,因此我尝试在IHTMLDocument2中编写整个html,但程序锁定了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.write()

我知道这有点晚了,但您可以尝试以下操作:

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);
            }
        }
    }