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

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!

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))

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

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

If you get sub window’s thread to global variable (Glo:Thread=THREAD()), you can manage that window with any procedure using POST command.

For example;
POST(EVENT:Iconize,Glo:Thread)
POST(EVENT:CloseWindow,Glo:Thread)
POST(EVENT:LoseFocus,Glo:Thread)
POST(EVENT:GainFocus,Glo:Thread)

or you can develop your custom events on sub window & call from any procedure using POST(EVENT:User,Glo:Thread)

CASE EVENT()
OF EVENT:User

END

I hope, it helps you.

Thanks.

Is Post or Notify the preferred inter-thread communication method?

That’s your choice, depending on your application structure but this one is working. (I’m using)