Delphi<=8 Forms Z-order

https://stackoverflow.com/questions/2997079/delphi-how-to-prevent-forms-msgboxes-to-move-under-prior-form

 

For old versions of delphi (prior to Delphi 2007), on forms OTHER than your main form:

interface

TMyForm = Class(TForm)

protected

procedure CreateParams(var Para: TCreateParams); override;

end;

...

implementation

...

procedure TMyForm.CreateParams(var Para: TCreateParams);

begin

inherited;

Para.Style := Para.Style or WS_POPUP;

{ WinXP Window manager requires this for proper Z-Ordering }

// Para.WndParent:=GetActiveWindow;

Para.WndParent := Application.MainForm.Handle;

end;

For message boxes include MB_TOPMOST in your flags:

Application.MessageBox(PChar(amessage), PChar(atitle), otherflags or MB_TOPMOST);

posted @ 2018-03-15 10:20  后凤凰  阅读(175)  评论(0)    收藏  举报