• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4126
  • Last Modified:

Use c# to check dll is registered

I need to check programmatically through c# that a particular 3rd party dll (rda2.dll) is registered.
Can anybody tell me how?

I need to do this as otherwise a particular part of my program will crash if dll not registered.
0
dbdp
Asked:
dbdp
  • 2
1 Solution
 
cookreCommented:
Enumerate the clsids under HKCR\CLSID.  For each one, the default value under InprocServer gives the path of the registered item.
0
 
dbdpAuthor Commented:
Could you tell me how to do that?
0
 
cookreCommented:
RegistryKey clsid=Registry.ClassesRoot.OpenSubKey("CLSID");
string[] ClsIDs=clsid.GetSubKeyNames();
string subkey="";
for (int i=0; i<ClsIDs.Length; i++)
    {
    subkey=ClsIDs[i];
    if (subkey.Substring(0,1)!="{") continue;
    RegistryKey cls=Registry.ClassesRoot.OpenSubKey("CLSID\\"+subkey+"\\InprocServer32");
    if (cls==null) continue;
    string x=cls.GetValue("","").ToString();
    }


x is the thing to look at.  Note that it may or may not be fully qualified.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now