B
Buddha
Unregistered / Unconfirmed
GUEST, unregistred user!
不解: 为何HTMLDocument := WebBrowser.Document as IHTMLDocument2;执行完后,HTMLDocument的值为nil?(100分)<br />兄弟从左轻候的阅读器源码中抄了如下一段用于在浏览器控件中显示Web页面,
procedure TfrmMain.ShowDetail(WebBrowser: TWebBrowser; Context: string);
var
vv: Variant;
HTMLDocument: IHTMLDocument2;
begin
vv := VarArrayCreate([0, 0], varVariant);
vv[0] := Context;
HTMLDocument := WebBrowser.Document as IHTMLDocument2;
HTMLDocument.write(PSafeArray(TVarData(vv).VArray));
HTMLDocument.charset := 'gb2312';
HTMLDocument.close;
end;
为什么执行完 HTMLDocument := WebBrowser.Document as IHTMLDocument2;
后,HTMLDocument的值为nil,导致浏览器控件不能显示任何内容?
procedure TfrmMain.ShowDetail(WebBrowser: TWebBrowser; Context: string);
var
vv: Variant;
HTMLDocument: IHTMLDocument2;
begin
vv := VarArrayCreate([0, 0], varVariant);
vv[0] := Context;
HTMLDocument := WebBrowser.Document as IHTMLDocument2;
HTMLDocument.write(PSafeArray(TVarData(vv).VArray));
HTMLDocument.charset := 'gb2312';
HTMLDocument.close;
end;
为什么执行完 HTMLDocument := WebBrowser.Document as IHTMLDocument2;
后,HTMLDocument的值为nil,导致浏览器控件不能显示任何内容?