[comp.windows.ms.programmer] Function to push a window behind other windows

nxh@meaddata.com (Nobuya "Higgy" Higashiyama) (11/20/90)

Help!  In my application I need to push a window to the bottom of stacked
windows, but I can't seem to find a function that will do that for me.  It's
pretty easy to put a window on top of every other window, since you only need
to call a function.  Question is: is there a technique I can use to accomplish
this in the absence of PushToBottom () function (or such)?  Thanks in advance!

									Higgy
--
Nobuya "Higgy" Higashiyama               |  ____/|
Mead Data Central, Dayton, OH            |  \ o.O|  Vote for Bill in '92!
Internet: nxh@meaddata.com               |   =(_)=
UUCP:     uunet!meaddata!nxh             |     U     ACK! THPHTH!

risto@tuura.UUCP (Risto Lankinen) (11/22/90)

nxh@meaddata.com (Nobuya "Higgy" Higashiyama) writes:

>Help!  In my application I need to push a window to the bottom of stacked
>windows, but I can't seem to find a function that will do that for me.  It's
>pretty easy to put a window on top of every other window, since you only need
>to call a function.  Question is: is there a technique I can use to accomplish
>this in the absence of PushToBottom () function (or such)?  Thanks in advance!

Hi!

One way would be to call EnumWindows() , and have the lpEnumFunc() call the
BringWindowToTop() for all but the desired window.  The display is kinda wild
for a while, because there isn't (is there?) a way to prevent windows from
being redrawn between calls.

That was the 'easy way'.  The harder (but prettier) way in Windows 3.0 is to
use the functions Begin-/End-/DeferWindowPos() .  They're used to manipulate
the window manager's internal list of windows in a number of ways, including
their size, location and the position in the list.  I think they're meant for
MDI applications to tile/cascade their child windows, but I've tried out, and
they work fine with task windows as well.  If you use them, take care with the
iconic windows.  I've noticed, that the 'text line' window underneath each is
actually a separate window, defering which you will want to synchronize with
the icon itself.  The deferring function is also powerful enough to resize
windows which otherwise couldn't, like Calculator or Control Panel.

Terveisin: Risto Lankinen
-- 
Risto Lankinen / product specialist ***************************************
Nokia Data Systems, Technology Dept *  2                              2   *
THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME!  Now working on 2 +1 *
replies: risto@yj.data.nokia.fi     ***************************************

rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (11/23/90)

In article <1979@meaddata.meaddata.com> nxh@meaddata.com (Nobuya "Higgy" Higashiyama) writes:
>Help!  In my application I need to push a window to the bottom of stacked
>windows, but I can't seem to find a function that will do that for me.  It's
>pretty easy to put a window on top of every other window, since you only need
>to call a function.  Question is: is there a technique I can use to accomplish
>this in the absence of PushToBottom () function (or such)?  Thanks in advance!

Use SetWindowPos() with the correct :-) arguments.

Kai Uwe Rommel

--
/* Kai Uwe Rommel
 * Munich
 * rommel@lan.informatik.tu-muenchen.dbp.de
 */

jls@hsv3.UUCP (James Seidman) (11/26/90)

In article <843@tuura.UUCP> risto@tuura.UUCP (Risto Lankinen) writes:
>[How to use Begin-/End-/DeferWindowPos() to arrange windows]
>If you use them, take care with the
>iconic windows.  I've noticed, that the 'text line' window underneath each is
>actually a separate window, defering which you will want to synchronize with
>the icon itself.

OK, I'll bite:  how can an iconic application get a window handle to the
'text line' underneath it, so that it can bring it to the front along with
its icon?

-- 
Jim Seidman (Drax), the accidental engineer.
"There's a certain freedom to being completely screwed." - The Freshman
UUCP: ames!vsi1!hsv3!jls	      Internet: hsv3.UUCP!jls@apple.com

petergo@microsoft.UUCP (Peter GOLDE) (11/27/90)

In article <1979@meaddata.meaddata.com> nxh@meaddata.com (Nobuya "Higgy" Higashiyama) writes:
>Help!  In my application I need to push a window to the bottom of stacked
>windows, but I can't seem to find a function that will do that for me.  It's
>pretty easy to put a window on top of every other window, since you only need
>to call a function.  Question is: is there a technique I can use to accomplish
>this in the absence of PushToBottom () function (or such)?  Thanks in advance!

The Programmers reference seems to say that

SetWindowPos(hWnd, 1, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)

should do the trick.  Have you tried this and found it not to work?

--Peter Golde, petergo%microsoft@uunet.uu.net

nxh@meaddata.com (Nobuya "Higgy" Higashiyama) (12/03/90)

In article <59325@microsoft.UUCP> petergo@microsoft.UUCP (Peter GOLDE) writes:
|>In article <1979@meaddata.meaddata.com> nxh@meaddata.com (Nobuya "Higgy" Higashiyama) writes:
|>>Help!  In my application I need to push a window to the bottom of stacked
|>>windows, but I can't seem to find a function that will do that for me.  It's
|>>pretty easy to put a window on top of every other window, since you only need
|>>to call a function.  Question is: is there a technique I can use to accomplish
|>>this in the absence of PushToBottom () function (or such)?  Thanks in
|>>advance!
>
>The Programmers reference seems to say that
>
>SetWindowPos(hWnd, 1, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)
>
>should do the trick.  Have you tried this and found it not to work?

Yes, this will work, but only for windows that are siblings of the same parent
(please tell me if I'm wrong).  I was originally thinking about being able to
push a window behind all other windows, sibling or otherwise.

									Higgy
--
Nobuya "Higgy" Higashiyama               |  ____/|
Mead Data Central, Dayton, OH            |  \ o.O|  Vote for Bill in '92!
Internet: nxh@meaddata.com               |   =(_)=
UUCP:     uunet!meaddata!nxh             |     U     ACK! THPHTH!

davidds@microsoft.UUCP (David D'SOUZA) (12/05/90)

In article <5922@hsv3.UUCP> jls@hsv3.UUCP (James Seidman) writes:
>OK, I'll bite:  how can an iconic application get a window handle to the
>'text line' underneath it, so that it can bring it to the front along with
>its icon?

Windows should do this automatically. If you bring the main window to
the front, the title should come with it.  The only problem was moving
the main window and the icon title doesn't move with it.  You can fix
this in a system independent way by hiding the main window, moving it,
and then showing it.

The nice thing about the Windows API is that it is appearing
everywhere.  Your windows knowledge is transferrable to other versions
of Windows (Multimedia, Handwriting, the OS/2 SMK, and future windows
environments).  The common base between these platforms is the
documented Windows API.  An app written to the windows api should work
on all these other environments.  An app written to the undocumented
API of one environment probably won't work elsewhere.


-- Dave