Einzelnen Beitrag anzeigen

Moony

Registriert seit: 29. Jul 2003
Ort: Essen
454 Beiträge
 
Delphi 2010 Professional
 
#3

Re: Fenster einer DLL in den Vordergrund

  Alt 14. Nov 2005, 13:44
Die DLL wird statisch aus der Applikation aus aufgerufen und nach Rückgabe des Wertes direkt wieder freigegeben:

Delphi-Quellcode:
function DLLLaden(dllname, functionname: String):Boolean;stdcall;export;
type Tcustfunction=function (var Names,Values:pchar):boolean;stdcall;

var cfunction : tcustfunction;
    custhdl : Thandle;
    Func : TFarProc;
begin
  ...
  custhdl := LoadLibrary(PChar(extractfilepath(application.exename) + dllname));
  custfunc := GetProcAddress(custhdl,pchar(functionname));
  if custfunc <> nil then
  begin
    @cfunction := custfunc;
    result:=true;
  end
  else begin
    result := false;
    FreeLibrary(custhdl);
    exit;
  end;
  result := cfunction(...,...);
  FreeLibrary(custhdl);
  ...
end;
Das Fenster wird ja dann normal mit dem Laden der DLL erzeugt. Aufgerufen wird das Fenster hier:

Delphi-Quellcode:
Procedure DLL.FormShow();
begin
  ...
  Fenster.ShowModal;
  if Fenster.ModalResult := mrCancel then Exit;
  ...
end;
dann...
Delphi-Quellcode:
Procedure Fenster.FormShow();
begin
  Fenster.BringToFront;
end;
Ich hoffe das kann dir weiterhelfen. Das sind die wichtigsten Aufrufe.

gruß, moony
Ich weiß, daß ich nichts weiß! Sokrates
  Mit Zitat antworten Zitat