Interface Question



Inheritance for IShellLink, IPersist, and IPersistFile is declared as
....

IShellLink = interfac(IUnknown) etc etc
IPersist = interface(IUnknown) etc etc
IPersistFile = interface(IPersist) etc etc

and I then see code of ...

var
ObjectIF : IUnknown;
ShellLinkIF : IShellLink;
PersistFileIF : IPersistFile;

begin

ObjectIf := CreateComObject(CLSID_Shellink);
ShellLinkIF := ObjectIF as IShellLink;
// do something with ShellLinkIF
PersistFileIF := ObjectIF as IPersistFile;
// do something with PersistFileIF

Now IShellLink has _none_ of the methods of IPersist or IPersistFile,
so _how_ can an IShellLink be typecast to an IPersistFile. Or is the
COM object of ObjectIF somehow re-created as an IPersistFile when
type-cast as such.

Alan Lloyd

.



Relevant Pages

  • Re: Interface Question
    ... ShellLinkIF: IShellLink; ... PersistFileIF: IPersistFile; ... ShellLinkIF:= ObjectIF as IShellLink; ... you're given a pointer to a pointer to a list of functions. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Interface Question
    ... ShellLinkIF: IShellLink; ... PersistFileIF: IPersistFile; ... ShellLinkIF:= ObjectIF as IShellLink; ...
    (comp.lang.pascal.delphi.misc)
  • A question about IShellLink interface and the COM object.
    ... We can query the object implementing IShellLink for IPersistFile to ... create a shortcut file. ...
    (microsoft.public.vc.language)