Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows
Hi all.
 
I create a window using the following:
 
SetWindowPos( hWnd ,HWND_TOPMOST, x, y, xx, yy, SWP_SHOWWINDOW | SWP_FRAMECHANGED );
 
Now if any other topmost window (for example Windows Task Manager) is launched the click on that window will bring it to the front. Then clicking on my window will bring the last to the front.
 
Is it possible to create a window that will always be over other windows which are created later? Smile | :)
 
[Edited after first 2 answers]
Well... I'll ask a question in other way, cause I've not asked a question "can I create most topmost of the top of the most topmost ...... (n+1)*(of the most topmost) window?" Smile | :)
 
Imagine that my application has 2 windows: W1 and W2, and they both are topmost.
All I want is W1 to be always in front of W2.
 
Of course it is possible having for example some if statements, but I wanna know if it is possible to tell the system to control these windows positions.
[End]
 
Eugen Podsypalnikov wrote:
Would it be not a case
of a modaless dialog (W1),
created by a window (W2) ?


No, this is not what I ask. "W1" and "W2" are independent from each other, so there should be possibility to operate in W1 while W2 is opened and vise versa/>
 
thanks in advance
Posted 31-Mar-10 3:37am
Edited 31-Mar-10 22:55pm
v4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

No: this is in fact an abuse of user patience.
If everything want to be topmost nothing will be topmost.
 
An even introducing another category - and another - and another ... -will just shift the same problem after some time if all devclopers want to be the "most topmost of the top of the most topmost"!
 
Moral of the story: let the user to decide which window is "topmost" and what is not, depending on what he's doing.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It would appear not. I have just tested as you described and it would appear that more than one TOPMOST window goes into a new group with their own Z-order. Since they are all competing to be topmost it is up to the user to click on the one that is wanted at any time. If windows had another value e.g. ABSOLUTE_TOPMOST you could still create multiple windows with the property.
 
The answer to your suplementary question is still "No". Read the MSDN documentation; any number of windows can be TOPMOST windows, but the user still has the choice of which one of them should be at the top of that group. Remember you are writing an application that is to be controlled by the user (otherwise why use Windows?) and that user needs to be able to decide which Window should remain at the top of the group.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

bartello wrote:
Imagine that my application has 2 windows: W1 and W2, and they both are topmost.
All I want is W1 to be always in front of W2.

 
Would it be not a case
of a modaless dialog (W1),
created by a window (W2) ? Smile | :)
 

bartello wrote:
so there should be possibility to operate in W1 while W2 is opened and vise versa

 
It would be possible
to operate in W1(a window)
while W2(its modaless dialog) is opened
and vise versa Smile | :)
  Permalink  
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

bartello wrote:
Imagine that my application has 2 windows: W1 and W2, and they both are topmost.
All I want is W1 to be always in front of W2.

 
If W2 is topmost, set W1 styles WS_POPUP|WS_CHILD and W2 as parent of W1.
It should achieve what you want.
cheers,
AR
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 310
1 CPallini 310
2 George Jonsson 269
3 Gihan Liyanage 255
4 OriginalGriff 245
0 OriginalGriff 4,903
1 CPallini 3,960
2 Sergey Alexandrovich Kryukov 3,474
3 George Jonsson 2,786
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web03 | 2.8.140905.1 | Last Updated 2 Apr 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100