> IUnknown

Since again I think my question has been misanswered....

the following works for objects

TMyList = class(TObject)
private
  FAccept :TClass;
  FItems :Array of TObject; // Simple array management used...
  function GetItems(Index :Integer):TObject;
  function GetCount:Integer;
public
  property Items[Index :Integer]:TObject read GetItems; default;
  property Count:Integer read GetCount;
  property Accept :TClass read FAccept write FAccept;
  function Add(O :TObject):Boolean;
  procedure Delete(Index :Integer);
  constructor Create(Accept :TClass);
  destructor destroy; override;
end;

constructor TMyList.Create(Accept :TClass);
begin
  inherited Create;
  FAccept := Accept;
end;

function TMyList.Add(O :TObject):Boolean;
begin
   Result := (FAccept<>nil) and (O is FAccept);
   if Result then begin
     SetLength(FItems,Length(FItems)+1);
     FItems[High(FItems)] := O;
   end;
end;

How can this storage of a Class *Type* be done for interfaces... If it's
been answered
I don't understand how to use the information... Note that FAccept contains
a class type
which is not known at the time of writing this object...

FAccept is a Class Reference as opposed to an Instance reference...

O :TObject; // an instance reference;
C :TClass; // a class reference

What is the equivelent for an Interface Type Reference as opposed to an
Interface instance reference...

I :Iunknown; // an interface instance reference
X :?????; // is there a way of storing which type of interface we're
interested in?

Since it's possible to ascertain if an interface IWhatEver is supported by
I. Is it possible to store IWhatever
in X so that we can ascertain if I supports X... I'm guessing it's going to
come down to storing the GUID of
IWhatEver and calling I.QueryInterface directly - in which case, how do you
extract the GUID of an Interface
type...

--
Aaron@home


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to