Also an dem
DLL Code liegts wohl nicht, habe folgendes getestet, funkt wunderbar, bis auf das, das die Form kein Icon hat.
Nur würde ich den Export vllt nicht gerade MainForm nennen, vllt beisst sich der Name mit etwas
Delphi-Quellcode:
library Project1;
uses
Forms,
Windows,
SysUtils,
Classes,
Unit1
in '
Unit1.pas'
{Form1};
procedure Test(AppHandle:THandle);
stdcall;
begin
Application.Handle:=appHandle;
try
with TForm1.Create(Application)
do begin
ShowModal;
Free;
end;
except
On E :
exception Do Application.HandleException(E);
end;
Application.Handle := 0;
end;
exports Test;
begin
end.
Delphi-Quellcode:
program Project1;
uses
Windows,
Forms;
{$R *.RES}
var Lib:Cardinal;
Test:procedure(AppHandle:THandle); stdcall;
begin
Application.Initialize;
Lib:=LoadLibrary('Project1.dll');
Test:=GetProcAddress(Lib, 'Test');
If Assigned(Test) then Test(Application.Handle);
// Grad zu faul um Ress frei zu gegeben
Application.Run;
end.