DLL"ka wygląda w skrócie tak:
////////////////////////////////* DLL *///////////////////////////////
var
DS: TScreen;
DA: TApplication;
procedure InitPlugin(App:Integer; Scr: Integer); stdcall;
begin
DS := Screen;
Screen := TScreen(Scr);
DA := Application;
Application := TApplication(App);
end;
procedure DonePlugin; stdcall;
begin
Screen := DS;
Application := DA;
end;
procedure Intro_dll(abaza_danych:shortstring); StdCall;
begin
with TfrmIntro.Create(Application) do <----- TUTAj wywala blad :/
begin
Baza_danych := abaza_danych;
ShowModal;
Free;
end;
end;
exports
Intro_dll,
InitPlugin,
DonePlugin;
/////////////////////PROGRAM///////////////////////////
procedure Uruchomienie_DLL_INIT;
type
TProcedura = procedure(abaza:shortstring) : TModalResult; StdCall;
TInitPlugin = procedure(App, Scr: Integer); StdCall;
TDonePlugin = procedure; stdcall;
var
LibHandle : THandle;
Procedura : TProcedura;
InitPlugin : TInitPlugin;
DonePlugin : TDonePlugin;
baza_danych : string;
begin
LibHandle :=LoadLibrary(PChar(ExtractFilePath(Application.ExeName) + 'DLL\Intro.dll'));
if LibHandle <> 0 then
begin
@Procedura:=GetProcAddress(LibHandle,'Intro_dll');
@InitPlugin := GetProcAddress(LibHandle, 'InitPlugin');
@DonePlugin := GetProcAddress(LibHandle, 'DonePlugin');
if (not(@Procedura = nil)) AND (not(@InitPlugin = nil)) AND (not(@DonePlugin = nil)) then
begin
InitPlugin(Integer(Application), Integer(Screen));
Procedura(baza_danych)
DonePlugin;
end;
FreeLibrary(LibHandle);
end
else
Application.MessageBox(PChar('Nie znaleziono biblioteki: '+ ExtractFilePath(Application.ExeName) + 'DLL\Intro.dll'),'Błąd',mb_IconError);
end;