Home arrow COM/COM+ arrow Page 3 - COM 101: A Quick Primer
COM/COM+

COM 101: A Quick Primer


Is COM dead? To some, yes. For those who are just starting out with Win32 DNA programming however, it's a different story. In this article Nevile gives us a quick COM primer.

Author Info:
By: Neville Mehta
Rating: 4 stars4 stars4 stars4 stars4 stars / 53
July 28, 2002
TABLE OF CONTENTS:
  1. · COM 101: A Quick Primer
  2. · Features Of COM
  3. · Identifying Individual Components
  4. · Conclusion

print this article
SEARCH DEVARTICLES

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:

A screenshot of 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:

<EXE NAME> /REGSERVER
blog comments powered by Disqus
COM/COM+ ARTICLES

- Coming To Grips With COM+
- COM 101: A Quick Primer

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials