A Beginner's Guide to COM Interfaces
So far I have outlined the background of COM Interfaces etc and you are still wondering what is a COM Interface? Well, an Interface is a way of publishing a set of properties and methods so that other programs can interface with your application through COM. This can be seen in the highly popular VBA scripting language found in most new Microsoft products. To see this in action, open VB, add a reference to the Microsoft Word 8 Object Model, and load up the Object Browser. From the Libraries combo box select Word. Take a look at the properties and methods that it exposes.
To use an interface within your own program you need to use class modules. First of all you create a class that contains only methods and member variables, except you place no code within these methods. This class will be implemented into another class. Let me explain. Say this first class is called IDataOject, and it contains a GetInfo and Save method. Well, you will want another class to take on or 'implement' IDataObject's methods and properties. We do this by using the Implements keyword. We now have another class that implements the IDataObject interface.
Page 3 of 6