djadja
asked on
How do I make a form I have in a DLL behave as if its part of the application?
My application calls a DLL function that in turn shows a form contained inside the DLL, eg.
application (form1)
DLL_Function_ShowForm(Appl ication);
dll: DLL_Function_ShowForm(oApp lication: TApplication);
with TfrmMessage.Create(nil) do begin
try
Label1.Caption:=oApplicati on.ExeName ;
ShowModal;
finally
Free;
end;
3 things wrong:
1. the form is shown as an extra 'program' on the taskbar and I don't want it to be...
2. If I obscure the application window and then use the taskbar button to re-activate it, it doesn't bring the message form to the top
3. If I obscure the message form and use the taskbar button to re-activate it, it doesn't bring the application's form up behind it.
I use the borlndmm.dll to pass objects and as you can see, I also pass the application object, I've tried "with TfrmMessage.Create(oApplic ation) do begin" but that doesnt work and it gives me an AV on exit.
Any ideas anyone?
application (form1)
DLL_Function_ShowForm(Appl
dll: DLL_Function_ShowForm(oApp
with TfrmMessage.Create(nil) do begin
try
Label1.Caption:=oApplicati
ShowModal;
finally
Free;
end;
3 things wrong:
1. the form is shown as an extra 'program' on the taskbar and I don't want it to be...
2. If I obscure the application window and then use the taskbar button to re-activate it, it doesn't bring the message form to the top
3. If I obscure the message form and use the taskbar button to re-activate it, it doesn't bring the application's form up behind it.
I use the borlndmm.dll to pass objects and as you can see, I also pass the application object, I've tried "with TfrmMessage.Create(oApplic
Any ideas anyone?
Listenning...
Hi,
try this:
in DLL:
function ShowDllForm1(AHandle: THandle; modal: boolean):LongInt;
begin
Application.Handle := AHandle;
if DllForm1 = nil then
DllForm1 := TDllForm1.Create(Applicati on);
Result := LongInt(DllForm1);
if modal then DllForm1.ShowModal
else DllForm1.Show;
end;
exports ShowDllForm1;
in app:
function ShowDllForm1(AHandle: THandle; modal: boolean):LongInt; external 'DllForm.dll';
procedure TForm1.Button1Click(Sender : TObject);
var
DllForm : LongInt;
begin
DllForm := ShowDllForm1(Application.H andle, false);
end;
Regards, Geo
try this:
in DLL:
function ShowDllForm1(AHandle: THandle; modal: boolean):LongInt;
begin
Application.Handle := AHandle;
if DllForm1 = nil then
DllForm1 := TDllForm1.Create(Applicati
Result := LongInt(DllForm1);
if modal then DllForm1.ShowModal
else DllForm1.Show;
end;
exports ShowDllForm1;
in app:
function ShowDllForm1(AHandle: THandle; modal: boolean):LongInt; external 'DllForm.dll';
procedure TForm1.Button1Click(Sender
var
DllForm : LongInt;
begin
DllForm := ShowDllForm1(Application.H
end;
Regards, Geo
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks a lot - will try it tonight...
ASKER
Fantastic - solved all 3 issues with such a -=SIMPLE=- line of code (duh!) - given you an extra 50!
Cheers
Cheers
Thanks a lot. Very nice of you.
Regards, Geo
Regards, Geo