[轉貼]使用程式方法進行 ocx 的元件註冊

有關Delphi 的語法, 程式, 等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

[轉貼]使用程式方法進行 ocx 的元件註冊

文章 tim »

使用程式方法進行 ocx 的元件註冊!!


http://www.swissdelphicenter.ch/en/showcode.php?id=1281
http://delphi.ktop.com.tw/topic.asp?met ... berID=8041

代碼: 選擇全部

     
    type  
      TDllRegisterServer = function: HResult; stdcall;  
     
    function RegisterOCX(FileName: string): Boolean;  
    var  
      OCXHand: THandle;  
      RegFunc: TDllRegisterServer;  
    begin  
      OCXHand := LoadLibrary(PChar(FileName));  
      RegFunc := GetProcAddress(OCXHand, 'DllRegisterServer');  
      if @RegFunc <> nil then  
        Result := RegFunc = S_OK  
      else  
        Result := False;  
      FreeLibrary(OCXHand);  
    end;  
     
    function UnRegisterOCX(FileName: string): Boolean;  
    var  
      OCXHand: THandle;  
      RegFunc: TDllRegisterServer;  
    begin  
      OCXHand := LoadLibrary(PChar(FileName));  
      RegFunc := GetProcAddress(OCXHand, 'DllUnregisterServer');  
      if @RegFunc <> nil then  
        Result := RegFunc = S_OK  
      else  
        Result := False;  
      FreeLibrary(OCXHand);  
    end;  
多多留言, 整理文章, 把經驗累積下來.....
回覆文章