How to: Determining programmatically if DLL is registered

Here is a C# code snippet to determine if a particular DLL is registered or not.


 


[DllImport(“kernel32”)]


public extern static int LoadLibrary(string lpLibFileName);


 


[DllImport(“kernel32”)]


public extern static bool FreeLibrary(int hLibModule);


 


public bool IsDllRegistered(string DllName)


{


      int libId = LoadLibrary(DllName);


      if (libId>0) FreeLibrary(libId);


      return (libId>0);


}


 


Source: http://blogs.msdn.com/asanto

One Response to “How to: Determining programmatically if DLL is registered”

  1.   aankit
    August 29th, 2009 | 1:14 pm       Reply

    man is there another namespace we have to use to determine this registered dll?

Leave a Reply