Delphi - create a form after another form

I use Delphi 4. I have a main form with a button that dynamically creates a new form. I would like the new shape to be visible, but to show the main shape at the top.

I tried to call SendToBack()right after FormCreate(). But this makes the window flicker quickly before it really goes back.

I tried to make the shape invisible, then SendToBack(), then Visible := true. But a new form is still to come.

It seems to SendToBack()work only with visible forms? How can I make the form display behind the main form?

+3
source share
2 answers

This worked for me:

SetWindowPos(newform.Handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_SHOWWINDOW
  or SWP_NOMOVE or SWP_NOOWNERZORDER or SWP_NOSIZE or SWP_NOACTIVATE);

newform.Visible := true;

!

+1

(, form2) , :

showWindow(form2.handle,SW_SHOWNOACTIVATE);

-don

0

Source: https://habr.com/ru/post/1742057/


All Articles