[fpc-pascal]Interfaces, What am I doing wrong?
sguenther at gmx.de
Mon May 12 09:01:38 CEST 2003
Jon Sawyer schrieb:
> I'm trying to learn how to use Interfaces. I'm going by Delphi's
> documentation. I know that I'm ignoring GUIDs but as far as I can tell from
> the docs there not vital. If there are how can I generate my own?? ^_^
I think there is a GUID generator included with Microsofts Platform SDK
> But I'm getting real stuck. The doc's on Delphi's web page mentions NOTHING
> about implementing IUnknown's methods. Do I have to?
Yes... The easiest way is to derive your implementation class from
TInterfacedObject. If you cannot use TInterfacedObject: Just use the
source of its implementation as a starting point for your code. AddRef
and Release are very easy to implement; if you need QueryInterface,
depends on your code. But it would be wise to implement QueryInterface
as well (which requires the usage of IIDs, of course).
More information about the fpc-pascal