Try to disable the WindowsGhosting. Here's an example code.
procedure DisableProcessWindowsGhosting;
var
DisableProcessWindowsGhostingImp : procedure;
begin
@DisableProcessWindowsGhostingImp :=
GetProcAddress(GetModuleHandle('user32.dll'),
'DisableProcessWindowsGhosting');
if (@DisableProcessWindowsGhostingImp <> nil) then
DisableProcessWindowsGhostingImp;
end;
begin
// Disable Window Ghosting for the entire application.
DisableProcessWindowsGhosting;
Application.Initialize;
Application.Title := 'Hidden Dialog Test';
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.
Which Delphi version are we talking about here?
To avoid Z-order problems as much as possible a modal form should
always use the currently active form as the API owner. How you achieve
that depends on the Delphi version you use. With the newer versions
(BDS 4 and up) you do it by setting Application.ModalPopupMode to
pmAuto (in the DPR file, before you create any forms) and by setting
your modal forms PopupMode to pmAuto as well. With this scheme to work
reliably you need to create the modal forms just before showing them
and destroy them again after they have been closed. With autocreated
forms used as modal forms you can run into situations where the last
owner form has died or changed its handle when you show the modal form
again.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
Delphi 2006, 2007:
Set the TForm.PopupMode and PopupParent properties
Delphi 5-2005:
Override TForm.CreateParams and set the Params.HwndParent field to the
main form' handle.
--
Regards,
Andreas Hausladen