delphi中实现dll文件自动注册

type  
      TDllRegisterServer=function:HResult;   stdcall;  
  procedure   RegisterDll(DllName   :string);  
  var  
      h:HModule;  
      Ocx:TDllRegisterServer;  
  begin  
      h   :=   0;  
      try  
          h   :=   LoadLibrary(PChar(DllName));  
          @Ocx:=GetProcAddress(H,'DllRegisterServer');  
          Ocx;  
      except  
          ShowWarning('注册'   +   DllName   +   '失败!请检查该文件是否存在。');  
      end;  
      FreeLibrary(H);  
  end;  

原文地址:https://www.cnblogs.com/martian6125/p/9631540.html