核心提示:function HTML2Intf(str:string):IHTMLDocument2;var hgbl: HGLOBAL; Stream: IStream; doc: ihtmldocument...
function HTML2Intf(str:string):IHTMLDocument2;var
hgbl: HGLOBAL;
Stream: IStream;
doc: ihtmldocument2;
psi: IPersistStreamInit;
begin
try
hgbl:=GlobalAlloc(GPTR,Length(str)+1);
if 0=hgbl then RaiseLastWin32Error;
CopyMemory(Pointer(hgbl),PChar(str),Length(str));
CreateStreamOnHGlobal(hgbl,True,Stream);
doc.QueryInterface(IPersistStreamInit,psi);
psi.InitNew;
psi.Load(Stream);
result:=doc;
except
result := nil;
end;
end;