cancel
Showing results for 
Search instead for 
Did you mean: 
davidh
Pilgrim

Good way to test if COM dll is already registered

I have a COM question that I feel like I should knowSmiley Sad What's a good way to tell if any version of a dll has already been registered on a machine?

Basically, the big picture problem is that a colleague needs a dll to be registered on a target machine prior to an install. He can obviously install\register the dll automatically but doesn't want to do that if any version of the dll is already on the target machine. I suggested checking HKEY_CLASSES_ROOT\CLSID\{GUID} but is there a better way?
Labels (1)
0 Kudos
5 Replies
RobertDickau
Pilgrim

Re: Good way to test if COM dll is already registered

Dave,

Apart from trying to load the COM class and catching an error, maybe look for HKCR\prog.id (where prog.id is whatever you'd pass to CoCreateObject)? The GUID would presumably change between versions, so if you want to check for any version, the version-independent ProgID might be the best...

Robert
0 Kudos
davidh
Pilgrim

Re: Good way to test if COM dll is already registered

Hi...and thanks Robert!

...I like your first idea of catching the error and I'll probably go with that.
0 Kudos

Re: Good way to test if COM dll is already registered

As an aside, this pattern is always a pain in the rear. You can jump through the hoops to do it right ( setup prereq probably ) or you can try to elminate the dependency or at least trade it for one you already have.

For example, I once had an install for a .NET 1.1 application that extended AppSearch by probing serial ports to detect a gate reader device and assign the com port to a property. Later the property was used for XML configuration data. This control had to be registered and hacked to allow calling it from script. All of this had to be done prior to the execute sequence.

Now days the .NET 1.1 application could be ported to .NET 2.0 and the SerialPort Class introduced in .NET 2.0 could be used via the supportfiles, comvisible wrapper class and DotNetCoCreateObject instead of the COM server.

Then again what do I know.... MC is evil, right?
0 Kudos
Highlighted
rajeev15
Pilgrim

How to search for HKCR\prog.id

Hi Robert,
I am trying to check for prog.id=smiacore.session (Third party software) before installing our software
I have this key.
HKEY_CLASSES_ROOT\CLSID\{1E0AE031-8DE6-11d8-A869-0002A58642EC}\Prog.id
I am not sure this key will remain same for ever. {1E0AE031-8DE6-11d8-A869-0002A58642EC}.

So How can I check for prog.id

Thank you
Rajeev
0 Kudos

Re: Good way to test if COM dll is already registered

Look in HKCR\Prog.ID .. for example,

HKCR\WindowsInstaller.Installer

But you'll notice the default registry value may be null. In that case, look at the CLSID subkey and check that it's default value has data.

Unfortunatly this is just a limitation of the AppSearch/Reglocator pattern. It can only check for registry values that are not null, it can't check for the existance of registry keys.
0 Kudos