Reputation: 49
I need the ability to set the window not only z-type (always top/always bottom/etc.), but also z-index (0..+inf.).
Windows with smaller z-index values should be lower than windows with greater.
I know about SetWindowPos and it`s parameter hWndInsertAfter, using it I can achieve what I want, but this way seems too complicated.
Is there better solution ?
Upvotes: 0
Views: 2845
Reputation: 51506
The windowing subsystem maintains the Z-Order, implemented as a list:
The system maintains the z-order in a single list.
You can move windows in this list (by calling SetWindowPos for example), passing the previous window as an index, or HWND_TOP
to move a window to the front. There is no API that uses an ordinal as the index.
If you need to insert a window ahead of another window, call GetNextWindow
(GW_HWNDPREV)
first to be passed as the hWndInsertAfter. If there is no window ahead in the z-order, GetNextWindow
returns NULL
, which conveniently maps to HWND_TOP
.
Upvotes: 2