COM 101: A Quick Primer - Identifying Individual Components (Page 3 of 4 )
As components are developed and used globally, we have to identify each component uniquely. Now how on earth do you think that this can be done? Well, the Open Software Foundation (OSF) came to the rescue and developed an algorithm that generates a unique identifier called the UUID (Universal Unique Identifier). In COM it's called the GUID (Global Unique Identifier). The GUID is a number, which is assigned to the interface, class or a library.
We wont get too much into the details of how this algorithm works, but let me tell you the aspects it takes into consideration when its generates that unique identifier:
The current date and time
The network adapter card address
The system clock
An automatically incremented counter
Now each COM object has a unique GUID for itself, but where are all of these GUID’s stored? They are stored in your registry. All COM classes are registered in the HKEY_CLASSES_ROOT\CLSID key. For each CLSID key, you also have a sub key called InProcServer32. The value of this sub key will be the filename of the DLL associated with this respective class. Let me show you a screenshot taken from my registry:
Here is an example. This component is an in-process DLL and has something to do with ICQ I assume. How did I know? Well I just checked the value of the InProcServer32 sub key and came to know which DLL this CLSID is associated with.
Whenever you create a component it will be in the form of an EXE or a DLL. You would have to register them on the machine you will be using them on. If you're distributing your component it could be a part of the installation procedure done automatically, invisible to the user. You could also do the same manually.
A DLL (Dynamic Link Library) can be registered using the following command:
REGSVR32 <DLL NAME>
An EXE (Executable) can be registered using the following command: