The function SetWindowPos, allows me only to put some window after another window. But I need to put some window before (above) another one. So, how to make this?
Posted on 2003-07-15 12:30:19 by JohnFound
Use SetForegroundWindow
Posted on 2003-07-15 12:38:38 by donkey
Well, if you're putting window A after window B, then what's to stop you from switching them and putting Window B after Window A? Which would essentially make Window A before Window B.
Posted on 2003-07-15 12:42:23 by iblis
Hi donkey.

Unfortunately, SetForgroundWindow will bring the window to the top of Z-order (above ALL windows, the same about SetWindowPos with HWND_TOP argument). I don't want this, but only to bring window above some other one (keeping Z-order for the rest of windows)
Posted on 2003-07-15 12:46:42 by JohnFound
Well use SetWindowPos and use a handle in hWndInsertAfter, it will not change the Z-Order of any windows but the target one. As Iblis so eloquently put it, you just have to decide the order of the windows:

invoke SetWindowPos,hWinA,hWinB,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE
invoke SetWindowPos,hWinB,hWinA,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE
Posted on 2003-07-15 12:51:22 by donkey
Hi, Iblis

So, the problem is a little bit more complex, than I describe.
I have 8 windows of type A and one window of type B. So, the A type windows are in diferent places in Z-order. I need to put all A-type windows above B type window. I tryed to put B window after every of the A windows, but the result is that when I put B window after last A window, some of the A windows are before and some after B window. I know that I can search the Z order for the lower A window, but actually I am lazy and I find easy way. I hope I am clear.... (I wonder.... :) )
Posted on 2003-07-15 12:54:39 by JohnFound
So in other words, you have this:
[size=12] __

|A |_
|_|A |___
|_|B __|
| |A |_
|_|_|A |_
|_|A |_
|_|A |

But you want to achieve this:
[size=12] ____

|B __|
| |A |_
|_|_|A |_
|_|A |_
|_|A |_
|_|A |_
|_|A |

Right? Well if SetWindowPos can't do it then I don't readily know what will, sorry. A quick search through the SDK will probably turn up something. I'll look for something.
Posted on 2003-07-15 13:07:09 by iblis

The DeferWindowPos function updates the specified multiple-window ? position structure for the specified window. The function then returns a handle to the updated structure. The EndDeferWindowPos function uses the information in this structure to change the position and size of a number of windows simultaneously. The BeginDeferWindowPos function creates the structure.

Try that?
Posted on 2003-07-15 13:10:20 by iblis
Yes, thank you. I was forget for this function. I will try it.
Posted on 2003-07-15 13:21:00 by JohnFound