March 3, 2021
Hot Topics:

A Beginner's Guide to COM Interfaces

  • By Sam Huggill
  • Send Email »
  • More Articles »

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

This article was originally published on November 17, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date