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;  

posted on 2007-01-15 13:01  martian6125  阅读(219)  评论(0编辑  收藏  举报