战
战鹰
Unregistered / Unconfirmed
GUEST, unregistred user!
TActiveFormX = class(TActiveForm, IActiveFormX, IBindStatusCallback)
。。。
var
FIStream:IStream;
FOleStream:TOleStream;
FIUnknown:IUnknown;
。。。
procedure TActiveFormX.Button1Click(Sender: TObject);
begin
URLOpenBlockingStream(FIUnknown,'http://210.76.63.134/',FIStream,0,self);
end;
function TActiveFormX.OnStopBinding(hresult: HResult;
szError: LPCWSTR): HResult;
var
i:integer;
tmp:Byte;
FMemoryStream:TMemoryStream;
begin
Result:=S_OK;
if hresult=S_OK then
begin
Memo1.Lines.Add('Downloaded.001');
FMemoryStream:=TMemoryStream.Create;
FMemoryStream.Clear;
FMemoryStream.Position:=0;
try
FOleStream.Create(FIStream);<<<<<<<这里出现异常(为什么?)
except
showmessage('Stream Error');
end;
FOleStream.Position:=0;
Memo1.Lines.Add(inttostr(FOleStream.Size));
for i:=1 to FOleStream.Size do
begin
FOleStream.Read(tmp,1);
FMemoryStream.Write(tmp,1);
end;
FMemoryStream.Position:=0;
Memo1.Lines.LoadFromStream(FMemoryStream);
end;
end;
function URLOpenBlockingStream(p1: IUnknown
p2: PChar
out p3: IStream
p4: DWORD
p5: IBindStatusCallback): HResult
stdcall;
这个函数到底怎么使用?p3如何定义?如何从p3中获得数据?
。。。
var
FIStream:IStream;
FOleStream:TOleStream;
FIUnknown:IUnknown;
。。。
procedure TActiveFormX.Button1Click(Sender: TObject);
begin
URLOpenBlockingStream(FIUnknown,'http://210.76.63.134/',FIStream,0,self);
end;
function TActiveFormX.OnStopBinding(hresult: HResult;
szError: LPCWSTR): HResult;
var
i:integer;
tmp:Byte;
FMemoryStream:TMemoryStream;
begin
Result:=S_OK;
if hresult=S_OK then
begin
Memo1.Lines.Add('Downloaded.001');
FMemoryStream:=TMemoryStream.Create;
FMemoryStream.Clear;
FMemoryStream.Position:=0;
try
FOleStream.Create(FIStream);<<<<<<<这里出现异常(为什么?)
except
showmessage('Stream Error');
end;
FOleStream.Position:=0;
Memo1.Lines.Add(inttostr(FOleStream.Size));
for i:=1 to FOleStream.Size do
begin
FOleStream.Read(tmp,1);
FMemoryStream.Write(tmp,1);
end;
FMemoryStream.Position:=0;
Memo1.Lines.LoadFromStream(FMemoryStream);
end;
end;
function URLOpenBlockingStream(p1: IUnknown
p2: PChar
out p3: IStream
p4: DWORD
p5: IBindStatusCallback): HResult
stdcall;
这个函数到底怎么使用?p3如何定义?如何从p3中获得数据?