Open a window and push it into the background? (Z order?)


#1

Hi,

Is there a method to open a window and send it to the background?

Here is what I want to do:

Open MDI child windowA (threadX)

Open MDI child WindowB (thread X + Y)

move windowB behind windowA

Thanks!


#3

You can post an event to your thread, and try setting 0{PROP:Active} on the window of the target thread.

If PROP:Active doesn’t act how you want, try this

MODULE('win32.lib')
    SetWindowPos(UNSIGNED, UNSIGNED, SIGNED, SIGNED, |
        SIGNED, SIGNED, UNSIGNED), LONG, PASCAL, RAW, DLL
END

After Opening the Window:

DISPLAY
i# = SetWindowPos(0{PROP:Handle}, -1, 0, 0, 0, 0, BOR(2, 1))

#4

Thanks for the quick reply! I’ll try the SetWindowPos as I want to minimize thread to thread messages.


#5

Hi Jeff,

Doesn’t the -1 value for the hwndInsertAfter parameter
(see https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setwindowpos )
set the window to the topmost position?

Whereas Jared want’s to force a window to the background - so maybe that value should be
HWND_BOTTOM = 1

i# = SetWindowPos(0{PROP:Handle}, 1, 0, 0, 0, 0, BOR(2, 1))

Graham