Another alternative is to wrapper the OLEVariant in an object before storing
in the TList. Or use a collection to do this, eg.
type
TOLECollectionItem = class(TCollectionItem)
public
Value: OLEVariant;
destructor Destroy; override;
end;
destructor TOLECollectionItem.Destroy;
begin
Value := Null;
inherited;
end;
then
ACollection := TCollection.Create(TOLECollectionItem);
with TOLECollectionItem(ACollection.Add) do begin
Value := ...
If you want to avoid the casts you can descend a new TOLECollection from
TCollection and override its methods to return TOLECollectionItems.
Cheers,
Carl
-----Original Message-----
From: Myles Penlington [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 2 August 2000 9:42 AM
To: Multiple recipients of list delphi
Subject: RE: [DUG]: List of OLEVariant
If I think what you are thinking, then neither will do the job.
You have to have an array declaration eg.
TOLEList = array of OLEVariant
OLEVariants are required to be finalized (or set to Null).
A variant is 16 bytes (at least) so this will not fit into a TList. You need
at least to create our own TOLEList etc or use dynamic arrays.
Myles.
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, August 02, 2000 11:06 AM
> To: Multiple recipients of list delphi
> Subject: [DUG]: List of OLEVariant
>
>
>
> Has anyone had to store a list of OLEVariant before? Are there any issues?
>
> Do I need a TInterfaceList or just a TList?
>
> If I use a TList and the OLEVariant is an interface then will it self
> destruct
> because the TList doesn't reference count?
>
>
> Thanks,
>
> Phil.
>
>
> --------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz