COM registration of PROGIDs.

We're almost done with this series (phew). Up until now, everything I've talked about w.r.t. COM registration has been required for one scenario or another.  However, there's one other common aspect of COM registration that is a wonderful convenience (although not necessary except for some relatively rare circumstances).

Of course, I'm talking about the progid.  The PROGID provides the ability to define a string alias for a particular COM object.  Thus with the PROGID, you can access a COM object without having to know it's CLSID.  This can be quite handy, especially when you're working in languages that don't provide easy access to a GUID data type.  A PROGID is simply a string representation of the class. 

By convention the PROGID has the form: <Program>.<Component>.<Version> and should be less than 39 characters in length.  There are a couple of other restrictions spelled out here.

So what are the minimal set of registry keys needed for a progid?

Well, they're:

Key: HKEY_CLASSES_ROOT\<ProgID>
    Default Value: Friendly name for ProgID.  Should contain the version number.
Key: HKEY_CLASSES_ROOT\<ProgID>\CLSID
    Default Value: CLSID of the object that matches this progid.

There's an alternate form of the progid, known as the version independent progid, this is simply a progid without the <Version> part of the name.  It has the same format as the version specific progid:

Key: HKEY_CLASSES_ROOT\<Version Independent ProgID>
    Default Value: Friendly name for ProgID.
Key: HKEY_CLASSES_ROOT\<Version Independent ProgID>\CLSID
    Default Value: CLSID of the object that matches this progid.
Key: HKEY_CLASSES_ROOT\<Version Independent ProgID>\CurVer
    Default Value: Version specific PROGID for this COM object.

You don't have to specify the CurVer key if you don't have multiple versions, but it's probably a good idea.

You also need to hook the progid's back up to the CLSID key for your COM object:

Key: HKEY_CLASSES_ROOT\CLSID\<Class ID>\ProgID
    Default Value: <PROGID> for this COM class.
Key: HKEY_CLASSES_ROOT\CLSID\<Class ID>\VersionIndependentProgIDProgID
    Default Value: <Version Independent PROGID> for this COM class.

Again, PROGID's are nice-to-have, but in no way are they required.  But they can be quite convenient so...