Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hwnd_topmost and zorder

102 views
Skip to first unread message

Roman K.

unread,
Nov 21, 2007, 6:11:50 PM11/21/07
to

Hello,

Is it possible to create application with main form and tool forms - all
"staying on top" in determined order?
Main form should be "topmost" above other applications, and tool forms
should be always above main form. I have to open tool forms by "Show"
(not "ShowModal").


I try for example:
SetWindowPos(Application.MainForm.Handle, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE);
SetWindowPos(Form1.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
SWP_NOSIZE or SWP_NOACTIVATE);
SetWindowPos(Form2.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
SWP_NOSIZE or SWP_NOACTIVATE);

All forms are staying on top but
Form1, Form2 are behind MainForm.

(Delphi7 Pro)

Thanks for any help

Roman

Peter Below (TeamB)

unread,
Nov 22, 2007, 12:55:49 PM11/22/07
to
Roman K. wrote:

>
> Hello,
>
> Is it possible to create application with main form and tool forms -
> all "staying on top" in determined order? Main form should be
> "topmost" above other applications, and tool forms should be always
> above main form. I have to open tool forms by "Show" (not
> "ShowModal").

override the CreateParams method of the tool forms and there do

inherited;
Params.WndParent := Application.Mainform.Handle;

That will tie the tool windows to the main form in Z order. After you
have done that you have to avoid any changes to mainform properties
that would cause the forms window handle to be recreated. If you cannot
avoid that you have to override the main forms CreateWnd method and,
after having called the inherited method, notify all open tool windows
that they need to recreate their handles, too (RecreateWnd method).


--
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

Roman K.

unread,
Nov 22, 2007, 4:52:35 PM11/22/07
to

>> Hello,
>>
>> Is it possible to create application with main form and tool forms -
>> all "staying on top" in determined order? Main form should be
>> "topmost" above other applications, and tool forms should be always
>> above main form. I have to open tool forms by "Show" (not
>> "ShowModal").
>
> override the CreateParams method of the tool forms and there do
>
> inherited;
> Params.WndParent := Application.Mainform.Handle;
>
> That will tie the tool windows to the main form in Z order. After you
> have done that you have to avoid any changes to mainform properties
> that would cause the forms window handle to be recreated. If you cannot
> avoid that you have to override the main forms CreateWnd method and,
> after having called the inherited method, notify all open tool windows
> that they need to recreate their handles, too (RecreateWnd method).
>
>

Thank you for your help,
Roman K.

0 new messages