Jeremy.
Try this.
function FileToVariant( const FilePath: WideString): OleVariant;
var
FS: TFileStream;
Size: Integer;
P: Pointer;
begin
Result := Null;
FS := TFileStream.Create( FilePath, fmOpenRead or fmShareDenyNone );
try
Size := FS.Size;
Result := VarArrayCreate( [ 0, Size -1], varByte );
P := VarArrayLock( Result );
try
FS.ReadBuffer( P^, Size);
finally
VarArrayUnlock( Result );
end;
except
Result := Null;
end;
FS.Free;
end;
Myles.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 25, 2000 9:04 PM
To: Multiple recipients of list delphi
Subject: [DUG]: passing variants
Hi all.
A while ago, I came across some code that will package-up say a file (or any
binary data) into a variant and pass it into a function in an OCX file.
UNFORTUNITLY....I cant remember where I saw it.
Has anyone by chance used code that does this sort of thing ?
Cheers, Jeremy Coulter
Jeremy Coulter (Manager)
Visual Software Solutions
Christchurch, New Zealand
PH 03-3521595
FAX 03-3521596
MOBILE 021-2533214
www.vss.co.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"