Einzelnen Beitrag anzeigen

barf00s
(Gast)

n/a Beiträge
 
#4

Re: procedure in dll auslagern

  Alt 6. Jul 2005, 11:25
File -> New -> Dll Library

Delphi-Quellcode:
library myProcedures;

uses
  Windows;

procedure myProcedureOne; stdcall;
begin
  MessageBox(0, 'myProcedureOne', 'w00t', MB_OK OR MB_ICONINFORMATION);
end;

extern
  myProcedureOne;

end.
--------------

in deinem programm das die dll laden soll

Delphi-Quellcode:
procedure LoadProcedureFromDll;
var
  hDll: cardinal;
  myProcedure: procedure;

begin
  hDll := LoadLibrary('myProcedures.dll');
  if hDll <> 0 then begin
    @myProcedure := GetProcAddress(hDll, 'myProcedureOne');
    if Assigned(@myProcedure) then
      myProcedure;
    FreeLibrary(hDll);
  end;
end;
  Mit Zitat antworten Zitat