Delphi OleVariant 取值/赋值操作

Delphi OleVariant 取值/赋值操作

procedure GetEData(sdata:OleVariant);  //取值
var
  sdata: OleVariant;
  High, Low, i: Integer;
  sList: TStringList;
begin
  sList:=TStringList.Create;
  try
    High := VarArrayHighBound(sdata, 1);
    Low := varArrayLowBound(sdata, 1);
    for i := Low to High do
    begin
      sList.Add(inttostr(sdata[i]))
    end;
  finally
    sList.Free;
  end;
end;

procedure SetEData(sdata:OleVariant);  //赋值
var
  i: Integer;
begin
  sdata := VarArrayCreate([0, 1000], varInteger);
  for i := 0 to 1000 do
    sdata[i] := i;
end;

 

 

创建时间:2021.02.03  更新时间:  

 

posted on 2021-02-03 14:25  滔Roy  阅读(632)  评论(0编辑  收藏  举报

导航