How to check if a DLL file is registered?

后端 未结 7 1799
一生所求
一生所求 2020-12-01 08:07

How do I find whether a DLL file written in C# is registered or not programmatically?

I already tried this code, but it doesn\'t come off.

If I register a DL

7条回答
  •  星月不相逢
    2020-12-01 08:08

    [DllImport("kernel32")]    
    public extern static bool FreeLibrary(int hLibModule);
    
    [DllImport("kernel32")]    
    public extern static int LoadLibrary(string lpLibFileName);
    
    
    
    public bool IsDllRegistered(string DllName)    
    {
    
          int libId = LoadLibrary(DllName);    
          if (libId>0) FreeLibrary(libId);    
          return (libId>0);    
    }
    

提交回复
热议问题