Jak mozna do twebbrowser załadować tfilestream lub do tego samego komponentu załadować tidmessage.body (komponent Indy)?????????????
{glowa}
--Le murdoc
0
0
procedure ieLoadFromStream(anIE: TWebBrowser; aStm: TStream);
const
IID_IPersistStreamInit: TGUID = '{7FD52380-4E07-101B-AE2D-08002B2EC713}';
var
iLen: Integer;
hContent: HGLOBAL;
hr: HRESULT;
iStm: IStream;
pHtmlDoc: IDispatch;
pPersistStreamInit: IPersistStreamInit;
begin
iLen := aStm.Size; if iLen = 0 then Exit;
hContent := GlobalAlloc(GPTR, iLen + 1);
if hContent 0 then // success
begin
aStm.Seek(0, soFromBeginning);
aStm.Read(Pointer(hContent)^, iLen);
hr := CreateStreamOnHGlobal(hContent, True, iStm);
if hr = 0 then // success
begin
pHtmlDoc := anIE.DefaultInterface.Document;
if pHtmlDoc nil then
begin
hr := pHtmlDoc.QueryInterface(IID_IPersistStreamInit, pPersistStreamInit);
if hr = 0 then // success
begin
hr := pPersistStreamInit.InitNew();
if hr = 0 then // success
hr := pPersistStreamInit.Load(iStm);
end;
end;
end;
end;
end;
procedure ieLoadFromString(anIE: TWebBrowser; aStr: String);
var
stm: TStream;
begin
stm := TStringStream.Create(aStr);
ieLoadFromStream(anIE, stm);
stm.Free;
end;
Call me Jarry