DEFINE CLASS Command - IMPLEMENTS Clause

Specifies to inherit the interface from another COM component.

[IMPLEMENTS cInterfaceName [EXCLUDE] IN TypeLib | TypeLibGUID | ProgID ]

Parameters

[IMPLEMENTS cInterfaceName [EXCLUDE] IN TypeLib | TypeLibGUID | ProgID]

Specifies that the class definition inherit the interface or class definition of another COM component. You can include multiple IMPLEMENTS statements.

NoteNote

Certain technologies, such as Microsoft COM+ Events, require the COM component to implement the interface of the event class being bound to.

The EXCLUDE keyword excludes the implemented interface from type library.

The IN clause specifies the location of the interface for the COM component. You can specify the type library of the COM object using TypeLib, the GUID of the type library using TypeLibGUID, or the ProgID of the program that initializes the COM object. When you use TypeLibGUID, include the major and minor version designation as shown in the following example:

 CopyCode imageCopy Code
IMPLEMENTS IDict1 IN {04BCEF93-7A77-11D0-9AED-CE3E5F000000}#1.0
NoteTip

The TypeLib parameter is the least recommended way to specify the type library because this requires a file name whose path might differ from computer to computer. If you are distributing your .dll, consider using TypeLibGUID or ProgID instead.

NoteNote

When you use the IMPLEMENTS clause, you must include all methods of that interface in the class definition. You must use the interface name exactly as it appears in the type library. However, for interface names preceded by an underscore (_), such as in the ADODB RecordSet class, the underscore is optional. Preface the method name with the interface name, for example, Publisher_ShowPrice. This convention helps avoid conflict between two interfaces that contain methods that have the same name when you include multiple IMPLEMENTS statements in a class definition. As properties are essentially stored as two methods inside a type library, for example, Put and Get, the class definition must include both methods.

NoteTip

To save time, you can use the Visual FoxPro Object Browser to drag and drop interface definitions to your code. Along with the IMPLEMENTS statement, all the implemented methods with their proper parameter signatures are written automatically for you. For more information, see Object Browser Window.

Expand imageRemarks

Expand imageExample

Expand imageSee Also


© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic