【发布时间】:2015-08-19 01:46:28
【问题描述】:
以下程序适用于 Windows XP、7-32、7-64、8-32、8-64,IE 8 到 11 版本以上不适用于新的 Windows 10,请参阅代码:
try
IDoc := CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
IDoc.Write(PSafeArray(VarArrayAsPSafeArray(VarArrayOf([xHtml])))); //Error windows 10
IDoc.Close;
except
on E: Exception do
begin
//E.ClassName = EOleException
//E.Message = Unspecified error
end;
end;
xHtml 是一个包含 HTML "<html>...</html>" 的字符串
我也尝试用这种方式编写 IHTMLDocument2,但出现了同样的错误:
IDoc := CreateComObject(Class_HTMLDOcument) as IHTMLDocument2;
v := VarArrayCreate([0, 0], VarVariant);
v[0] := xHtml;
IDoc.Write(PSafeArray(TVarData(v).VArray));
IDoc.Close;
我还检查了 Windows 10 中是否有 mshtml.dll,并且有。
【问题讨论】:
-
“不工作”是什么意思?
-
我的意思是在10个寡妇中,错误发生,并没有。
-
什么是
xHtml?是字符串吗? -
是的,xHtml 是一个包含 html "..." 的字符串
标签: delphi windows-10 ihtmldocument2