I'm thinking of checking the registry to see if a COM object is registered when my app is executed. This way I'm not reliant on my install app to do the job correctly and a registry goof, etc. becomes moot. Is it ok to just look under "HKEY_CLASSES_ROOT\CLSID\" for the ClassID and if I don't find it to call regsvr32 before creating the object?

I'm thinking of it like this:

1. look under "HKEY_CLASSES_ROOT\CLSID\" for "{BBCE2B80-FE99-11D5-A324-0050BA5A9F26}".
2. If found create the object, etc.
3. If not found call regsvr32 in silent mode. Then create the object.

Is there a better way?
Posted on 2002-11-27 09:21:45 by Xtreme
The link i gave in This Thread, or *if* geocities will let you download the .chm, offers a section as follows:

Registering COM Servers

After you have defined a class in code (ensuring that it implements IClassFactory or IClassFactory2) and assigned it a CLSID, you need to put information in the registry that will allow OLE, on request of a client with the CLSID, to create instances of its objects. This information tells the system, for a given CLSID, where the DLL or EXE code for that class is located, and how it is to be launched. There is more than one way of registering a class in the registry. In addition, there are other ways of ?registering? a class with the system when it is running, so the system is aware that a running object is currently in the system. These topics are described in the following sections:

Registering a Class at Installation

Registering a Running EXE Server

Registering Objects in the ROT


Installing as a Win32 Service or User Account

Posted on 2002-11-27 20:34:28 by NaN
Excellent! Thanks NaN. I visited the original web site and got a lot of good info...
Posted on 2002-11-28 10:16:55 by Xtreme