Thema: Delphi Procedure in DLL?

Einzelnen Beitrag anzeigen

Benutzerbild von Sprint
Sprint

Registriert seit: 18. Aug 2004
Ort: Edewecht
712 Beiträge
 
Delphi 5 Professional
 
#10

Re: Procedure in DLL?

  Alt 9. Jan 2005, 20:11
Zitat von Bluemeus:
könnte mir jmd. den aufbau mal erklären, ob ich stdcall benötige etc..?!
Delphi-Quellcode:
library Project2;

uses
  Windows, SysUtils, Registry;

var
  FRegistry: TRegistry;

{--------------------------------------------------------------------------------------------------}

procedure OpenKey(const Key: PChar);
begin

  if not Assigned(FRegistry) then FRegistry := TRegistry.Create;
  FRegistry.OpenKey(Key, True);

end;

{--------------------------------------------------------------------------------------------------}

procedure CloseKey;
begin
  FreeAndNil(FRegistry);
end;

{--------------------------------------------------------------------------------------------------}

procedure LibraryProc(Reason: Integer);
begin

  case Reason of
    DLL_PROCESS_DETACH: if Assigned(FRegistry) then FRegistry.Free;
  end;

end;

{--------------------------------------------------------------------------------------------------}

exports
  OpenKey, CloseKey;

{--------------------------------------------------------------------------------------------------}

begin
  DllProc := LibraryProc;
end.
Ciao, Sprint.

"I don't know what I am doing, but I am sure I am having fun!"
  Mit Zitat antworten Zitat