请教高手 idhttp.post 得到的网页内容(网页代码) 怎么显示网页(web页面)html ???(100分)

L

loving

Unregistered / Unconfirmed
GUEST, unregistred user!
请教高手 idhttp.post 得到的网页内容(网页代码) 怎么显示网页(web页面)html ??
我用这个过程 显示页面 图片 按钮等现实不了 报错
procedure TForm1.SetHtml(AWebBrowser: TWebBrowser; const Html: string);
var
Stream: IStream;
hHTMLText: HGLOBAL;
psi: IPersistStreamInit;
begin
WITH AWebBrowser do
begin
if Busy then Stop;
if not Assigned(Document) then WebBrowserClear(AWebBrowser);
while (ReadyState <> ReadyState_Complete) do
forms.Application.ProcessMessages;
hHTMLText := GlobalAlloc(GPTR, Length(Html) + 1);
if 0 = hHTMLText then RaiseLastWin32Error; //old delphi
//if 0 = hHTMLText then RaiseLastOSError;
CopyMemory(Pointer(hHTMLText),
PChar(Html), Length(Html));
OleCheck(CreateStreamOnHGlobal
(hHTMLText, True, Stream));
try
OleCheck(Document.QueryInterface(IPersistStreamInit, psi));
try
OleCheck(psi.InitNew);
OleCheck(psi.Load(Stream));
finally
psi := nil;
end;
finally
Stream := nil;
end;
end;
end;
 
顶部