In this post, you’ll learn more about the GetInterface method or DelphiVCL.Application.GetInterface is used to retrieve 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.
- In C++ code, use the templated version of GetInterface to obtain an interface from a DelphiInterface object.
GetInterface is equivalent to as the operator (Delphi) and dynamic casts (C++), except that GetInterface does not raise an exception if the interface is not supported. Learning how to do it will allow you to easily build GUIs with Python Windows GUI Builder.
Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Application.GetInterface using dir() command:
1 2 3 |
import DelphiVCL dir(DelphiVCL.Application.GetInterface) |
See the responses in our Windows command prompt:
You can also read short information about the DelphiVCL.Application.GetInterface using the print() command:
1 2 |
print(DelphiVCL.Application.GetInterface) print(DelphiVCL.Application.GetInterface.__doc__) |
See the responses in our Windows command prompt:
Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.