Mega Code Archive

 
Categories / Delphi / System
 

How to display a modal form stored in a DLL

Title: How to display a modal form stored in a DLL? Question: Anyone know how to display a modal form in a DLL file? Whenever I try, the modal form shows up on the taskbar and stays on top, even when you switch to other windows. Answer: procedure ShowDLLForm( appHandle: HWND ); stdcall; begin if appHandle = 0 then apphandle := GetActiveWindow; application.handle := appHandle; try with TDLLForm.Create( Application ) do try ShowModal finally free; end except on E: Exception do application.HandleException( E ); end; application.handle := 0; end;