Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#2

AW: OleVariant zu TBytes

  Alt 28. Jun 2014, 09:56
16 ms - vorher über 2000 ms!

Delphi-Quellcode:
Function VariantToBytes(Const Value: Variant): TBytes;
Var
  Size: Integer;
  pData: Pointer;
Begin
  Size := Succ(VarArrayHighBound(Value, 1) - VarArrayLowBound(Value, 1));
  SetLength(Result, Size);
  pData := VarArrayLock(Value);
  Try
    Move(pData^, Pointer(Result)^, Size);
  Finally
    VarArrayUnlock(Value);
  End;
End;


procedure TForm2.Button1Click(Sender: TObject);
var
  bytestr : TBytesStream;
  stamp1 : Integer;
  stamp2 : Integer;
  stamp3 : Integer;
// byte : Array of UInt8;
  byte : TBytes;
begin
  try
    stamp1 := GetTickCount;

// byte := Ole;

    byte:= VariantToBytes(ole);

    stamp2 := GetTickCount;
...

Geändert von hathor (28. Jun 2014 um 10:26 Uhr)
  Mit Zitat antworten Zitat