Keeping VB Components Compatible

GUIDs and TypeLibs and Interfaces

Unfortunately, to understand the different compatibility levels, the first place we need to go is deep into the bowels of COM. At its heart, a COM component provides services to its clients by exposing classes. By using these classes, it is possible for clients to create objects and manipulate properties and methods to their benefit. The set of properties and methods that are exposed by a class (the ones that are declared as Public) is called its interface. The information about the interface, including each property (name and data type) and method (name, parameter list and data type) is contained in a type library, also called a TypeLib. For VB components, the TypeLib is stored as a resource in the DLL/OCX file. For C++ components, it is usually be found in a separate file with a .tlb extension.

Now the first time you compile your ActiveX project, each interface (remember that each class has its own set of properties and methods and therefore its own interface) is automatically assigned a Globally Unique Identifier, or GUID. This is a 128-bit number that is used to identify the interface. How unique? Well, you would have to compile your application multiple times a second for well over a century in order to generate a conflicting GUID. This GUID is stored in your registry and acts as a link between the component's interface, the class name and the file that contains the executable code.

You might also like...

Comments

About the author

Bruce Johnson Canada

I am the owner of a small application development consulting company that specialized in the design and implementation of Internet-based applications. While there are others who can make a web ...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is anticipated with distaste, performed with reluctance, and bragged about forever.” - Dan Kaminsky