I'm using Delphi 4. I have a main form with a button that dynamically creates a new form. I'd like the new form to be visible, but to show up BEHIND the main form.
I've tried calling SendToBack()
immediately after FormCreate()
. But that makes the window flicker quickly before it's actually sent to back.
I've tried making the form invisible, then SendToB开发者_如何学编程ack()
, then Visible := true
.
But the new form is still at the front.
It looks like SendToBack()
only works with visible forms? How can I cause the form to be shown behind the main form?
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;
Thanks for help!
make the second window (e.g. form2) invisible, then call:
showWindow(form2.handle,SW_SHOWNOACTIVATE);
-don
精彩评论