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

Published Friday, January 27, 2006 4:02 PM by Vipul Patel
Filed under: , , ,

Comments

# polysyncronism.com » Blog Archive » How to: Determining programmatically if DLL is registered - C#, VS Deployment and all geek talk

Pingback from  polysyncronism.com  » Blog Archive   » How to: Determining programmatically if DLL is registered - C#, VS Deployment and all geek talk

Leave a Comment

(required) 
(required) 
(optional)
(required)