H
hongw21
Unregistered / Unconfirmed
GUEST, unregistred user!
我用Delphi写了个ActiveX控件,有个方法利用OleVariant传入TMemoryStream类型的参数如下,我的问题是 1、我这样传入TMemoryStream类型的参数是否正确,2、如何在JavaScript中调用
procedure TWfUrgeX.ShowWf(WfStream: OleVariant);
var AStream : TMemoryStream;
pointer;
begin
AStream := TMemoryStream.Create;
try
Chart.BeginUpdate;
Chart.Clear;
p := VarArrayLock(WfStream);
AStream.Write(p^, VarArrayHighBound(WfStream,1) + 1);
AStream.Position := 0;
Chart.LoadFromStream(AStream);
Chart.EndUpdate;
finally
VarArrayUnlock(WfStream);
AStream.Free;
end;
end;
procedure TWfUrgeX.ShowWf(WfStream: OleVariant);
var AStream : TMemoryStream;
pointer;
begin
AStream := TMemoryStream.Create;
try
Chart.BeginUpdate;
Chart.Clear;
p := VarArrayLock(WfStream);
AStream.Write(p^, VarArrayHighBound(WfStream,1) + 1);
AStream.Position := 0;
Chart.LoadFromStream(AStream);
Chart.EndUpdate;
finally
VarArrayUnlock(WfStream);
AStream.Free;
end;
end;