Visual Basic Concepts
Creating Standard Interfaces with Visual Basic
You can create standard interfaces for your organization by compiling abstract classes in Visual Basic ActiveX DLLs or EXEs, or with the MkTypLib utility, included in the Tools directory.
The MkTypLib utility may be more comfortable for you if you’re an experienced user of Microsoft Visual C++.
Basic programmers may find it easier to create an interface using a Visual Basic class module. Open a new ActiveX DLL or EXE project, and add the desired properties and methods to a class module. Don’t put any code in the procedures. Give the class the name you want the interface to have, for example
IFinance, and make the project.
*Note* The capital "I" in front of interface names is an ActiveX convention. It is not strictly necessary to follow this convention. However, it provides an easy way to distinguish between abstract interfaces you’ve implemented and the default interfaces of classes. The latter are usually referred to by the class name in Visual Basic.
The type library in the resulting .dll or .exe file will contain the information required by the Implements statement. To use it in another project, use the Browse button on the References dialog box to locate the .dll or .exe file and set a reference. You can use the Object Browser to see what interfaces a type library contains.
*Important* The Implements feature does not support outgoing interfaces. Thus, any events you declare in the class module will be ignored.
As explained in "Providing Polymorphism by Implementing Interfaces," an interface once defined and accepted must remain invariant, to protect applications written to use it. DO NOT use the Version Compatibility feature of Visual Basic to alter standard interfaces.
*For More Information* The related topic "Providing Polymorphism by Implementing Interfaces" discusses such important concepts as interface invariance and factoring. "Implementing and Using Standard Interfaces" explains how interfaces are implemented and used in components.