2006. március 4., szombat

Display a modal form stored in a DLL


Problem/Question/Abstract:

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;

Nincsenek megjegyzések:

Megjegyzés küldése