Einzelnen Beitrag anzeigen

Alter Mann

Registriert seit: 15. Nov 2003
Ort: Berlin
934 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#16

Re: Variant + varStrArg = was ist das?

  Alt 20. Apr 2009, 11:15
Schau mal, so oder so ähnlich sollte es gehen.

Das Beispiel stammt aus einer Wmi-Geschichte:
Delphi-Quellcode:
  function GetArrayContent(FWMIObj: ISWbemObject; PropName: string): string;
  var
    idx: Integer;
    RS : String;
  begin
    RS := '[';
    if (VarIsNull(FWMIObj.Properties_.Item(PropName, 0).Get_Value)) or
       (VarArrayHighBound(FWMIObj.Properties_.Item(PropName, 0).Get_Value, 1) <= 0) then
      RS := RS + ']'
    else
    begin
      for idx := 1 to VarArrayHighBound(FWMIObj.Properties_.Item(PropName, 0).Get_Value, 1) do
        RS := RS + VarToStr(FWMIObj.Properties_.Item(PropName, 0).Get_Value[idx]) + ', ';
    end;
    if Length(RS) > 2 then RS := Copy(RS, 1, Length(RS) - 2) + ']';
    Result := RS;
  end;
Gruß
  Mit Zitat antworten Zitat