System.TObject.GetInterface

From RAD Studio VCL Reference
Jump to: navigation, search

Contents

Delphi Information

From System.pas

	function GetInterface(const IID: TGUID; out Obj): Boolean;


Unit: System

Type: method

Visibility: public

Member Of: TObject

C++ Information

From System.hpp

	bool __fastcall GetInterface(const _GUID & IID, void * Obj);
 
	bool __fastcall GetInterface(System::DelphiInterface<T> & smartIntf);


Unit: System

Type: method

Visibility: public

Member Of: TObject

Description

Retrieves a specified interface.


GetInterface retrieves the interface designated by a GUID or type name. The basic implementation of GetInterface uses the GUID specified in the IID parameter. If the specified interface is supported by the class, it is returned in the Obj parameter, and GetInterface has a return value of True. Otherwise, Obj contains nil (Delphi) or NULL (C++), and GetInterface returns False.

Note:  In Delphi code, IID can be an interface name. The compiler automatically translates this name into the corresponding GUID.
Note:  In C++ code, use the templated version of GetInterface to obtain an interface from a DelphiInterface object.

GetInterface is equivalent to the as operator (Delphi) and dynamic casts (C++), except that GetInterface does not raise an exception if the interface is not supported.

See Also

Personal tools
Translations
Newest Version