Board index » delphi » Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent
Rob Kennedy
Delphi Developer |
Rob Kennedy
Delphi Developer |
Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent2004-10-05 03:58:55 AM delphi150 Cedric Pemberton writes: QuoteCan Some one give me an indication of how to extract a list of it contains an array of TInterfaceEntry records. Look in TObject.GetInterface and GetInterfaceEntry to see how that structure is used. Note that this will only give you a list of interfaces that a class is *declared* as implementing. An object may actually implement whatever interfaces you want by overriding the IUnknown.QueryInterface method. -- Rob |
Cedric Pemberton
Delphi Developer |
2004-10-05 04:27:14 AM
Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent
Thanks Guys.
Cedric Pemberton writes: QuoteCan Some one give me an indication of how to extract a list of |
Hechicero
Delphi Developer |
2004-10-05 10:56:59 PM
Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent
Is there a way todo it with automation objects?
"Rob Kennedy" <.>escribi?en el mensaje QuoteCedric Pemberton writes: |
Joanna Carter (TeamB)
Delphi Developer |
2004-10-05 11:04:41 PM
Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent
"Hechicero" <XXXX@XXXXX.COM>a écrit dans le message de news:
XXXX@XXXXX.COM... QuoteIs there a way todo it with automation objects? Joanna Consultant Software Engineer TeamBUG support for UK-BUG TeamMM support for ModelMaker |
Constantine Yannakopoulos
Delphi Developer |
2004-10-06 05:42:14 PM
Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent
Author := "Hechicero";
| Is there a way todo it with automation objects? Yes, provided that a type library is registered for them. In short QI for IDispatch and get its ITypeInfo class information interface by calling IDispatch.GetTypeInfo(0). Then call ITypeInfo.GetContainingTypeLib to get an ITypeLib interface pointer for the type library of the object. Enumerate the type library to find the object's CoClass member and then call GetTypeAttr and inspect the cImplTypes member to find the number of implemented interfaces. Finally call GetRefTypeOfImplType() and GetRefTypeInfo in a loop to get the type information object of all interfaces thisCoClass is stated to implement in the type library. For more information see the documentation in MSDN for IDispatch/ITypeInfo/ITypeLib. HTH. -- "If something hits the fan it is not distributed evenly." |
Joanna Carter (TeamB)
Delphi Developer |
2004-10-06 05:49:07 PM
Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent
"Constantine Yannakopoulos" <XXXX@XXXXX.COM>a écrit dans le
message de news: XXXX@XXXXX.COM... QuoteYes, provided that a type library is registered for them. But maybe that is a good thing :-)) Joanna Consultant Software Engineer TeamBUG support for UK-BUG TeamMM support for ModelMaker |
Joanna Carter (TeamB)
Delphi Developer |
2004-10-06 06:00:14 PM
Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent
"Joanna Carter (TeamB)" <XXXX@XXXXX.COM>a écrit dans le message
de news: XXXX@XXXXX.COM... QuoteBut maybe that is a good thing :-)) Consultant Software Engineer TeamBUG support for UK-BUG TeamMM support for ModelMaker |
Bjørge Sæther
Delphi Developer |
2004-10-07 07:57:00 AM
Re: How to get a list of interfaces implemented by a TInterfacedObjectdecendent
Joanna Carter (TeamB) writes:
Quote"Constantine Yannakopoulos" <XXXX@XXXXX.COM>a écrit generic interfaces used the "MI" way, IMHO. The discussions on Interfaces / classes in this NG usually ends up in a conclusion that "mixing object- and interface references is bad". This relates to one of the possible usages of interfaces, the "model by Interfaces" one. I have now another case for using Interfaces, the "how may I make this routine work both for a collection of objects and a dataset ? Yes, by declaring an interface that may be implemented by both classes. No need to worry especially about reference counting, then, not more than the regular taking care of freeing appropriately. And for COM interfaces - they don't respond to 'Release' no matter what. Well, it is a little unpredictable what happens when you clear your reference to the 'Application' object of an Automation server. Excel, e.g., won't close down unless you call Quit;, but other servers do only by clearing the reference. Forcing the programmer to use automatic lifetime control isn't the one and only way. -- Regards, Bjørge Sæther XXXX@XXXXX.COM ------------------------------------- I'll not spend any money on American Software products until armed forces are out of Iraq. |