Ich rufe wie unten beschrieben ein MDI Fenster aus einer DLL auf.
Leider habe ich das Problem unter Delphi 5 funktioniert die Tabulatortaste und Alt-Hotkeys der MDI-Fenster nicht mehr. Die Hauptfenster funktionieren voll normal, Modale Fenster auch. hat jemand das problem schon in dieser form gekannt oder kann mir sagen, wie ich dem aus dem Weg gehen kann???
TYPE
T_ProvaChild = procedure (ParentApplication: TApplication; ParentForm: TForm); stdcall;
procedure TMainForm.StartClick(Sender: TObject);
var
DllHandle: THandle;
ProcAddr: FarProc;
ProvaChild: T_ProvaChild;
begin
DllHandle := LoadLibrary('ProjectDll');
ProcAddr := GetProcAddress(DllHandle, 'ProvaChild');
if ProcAddr <> nil then
begin
ProvaChild := ProcAddr;
ProvaChild(Application,Self);
end;
end;
DLL-Code:
VAR
DllApplication : TApplication;
procedure ProvaChild(ParentApplication: TApplication; ParentForm: TForm); export; stdcall;
var
Form1: TForm1;
begin
IF DllApplication = NIL THEN DllApplication := Application;
Application:=ParentApplication;
Form1:=TForm1.Create(ParentForm);
Form1.Name := '';
Form1.MyParentForm:=ParentForm;
Form1.MyParentApplication:=ParentApplication;
Form1.Show;
end;
procedure DLLUnloadProc(Reason: Integer); register;
begin
if Reason = DLL_PROCESS_DETACH then Application:=DllApplication;
end;
exports
ProvaChild;
begin
DllApplication:=Application;
DLLProc := @DLLUnloadProc;
end.
Leider habe ich das Problem unter Delphi 5 funktioniert die Tabulatortaste und Alt-Hotkeys der MDI-Fenster nicht mehr. Die Hauptfenster funktionieren voll normal, Modale Fenster auch. hat jemand das problem schon in dieser form gekannt oder kann mir sagen, wie ich dem aus dem Weg gehen kann???
TYPE
T_ProvaChild = procedure (ParentApplication: TApplication; ParentForm: TForm); stdcall;
procedure TMainForm.StartClick(Sender: TObject);
var
DllHandle: THandle;
ProcAddr: FarProc;
ProvaChild: T_ProvaChild;
begin
DllHandle := LoadLibrary('ProjectDll');
ProcAddr := GetProcAddress(DllHandle, 'ProvaChild');
if ProcAddr <> nil then
begin
ProvaChild := ProcAddr;
ProvaChild(Application,Self);
end;
end;
DLL-Code:
VAR
DllApplication : TApplication;
procedure ProvaChild(ParentApplication: TApplication; ParentForm: TForm); export; stdcall;
var
Form1: TForm1;
begin
IF DllApplication = NIL THEN DllApplication := Application;
Application:=ParentApplication;
Form1:=TForm1.Create(ParentForm);
Form1.Name := '';
Form1.MyParentForm:=ParentForm;
Form1.MyParentApplication:=ParentApplication;
Form1.Show;
end;
procedure DLLUnloadProc(Reason: Integer); register;
begin
if Reason = DLL_PROCESS_DETACH then Application:=DllApplication;
end;
exports
ProvaChild;
begin
DllApplication:=Application;
DLLProc := @DLLUnloadProc;
end.
Comment