Jump to content

Recommended Posts

Posted

Hi All,

I'd like to move a window to the top of the stack without it being active.
I think it's called z-order in programming?

I've tried these 2 options (commenting out 1 at a time obviously), but the 1st doesn't seem to do anything, and the 2nd prevents it from being moved behind the other programs even after clicking on it and then clicking on another window behind it:

Local $hWnd = WinGetHandle("[CLASS:MSPaintApp]")
_WinAPI_SetWindowPos($hWnd, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE))
_WinAPI_SetWindowPos($hWnd, $HWND_TOPMOST, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOMOVE, $SWP_NOSIZE))

What can I do to move something to the top of the z-order while allowing it to be manually moved back in the z-order?

Thanks!

Posted

Thanks JohnOne, I've added that in, however I'm still in the same position, $HDND_TOP doesn't move the window to the top of the z-order, actually it doesn't seem to move it at all in the z-order, any ideas how I can get it to move to the top of the z-order without it permanently remaining the top of the z-order (which $HWND_TOPMOST seems to do)?

This is my current code:
Local $hWnd = WinGetHandle("[CLASS:MSPaintApp]")
_WinAPI_SetWindowPos($hWnd, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_FRAMECHANGED, $SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOSIZE))

Posted

How about something like this?

#include <Constants.au3>
#include <WinApi.au3>

Local $hWnd = WinGetHandle("[ACTIVE]", "")

$iPID = Run("notepad.exe")
Sleep(200)
WinActivate($hWnd)
Sleep(500)

$hWnd = WinGetHandle("[CLASS:Notepad]")
_WinAPI_SetWindowPos($hWnd, $HWND_TOPMOST, 0, 0, 0, 0, BitOR( $SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOSIZE))
_WinAPI_SetWindowPos($hWnd, $HWND_NOTOPMOST, 0, 0, 0, 0, BitOR( $SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOSIZE))

Sleep(2000)
ProcessClose($iPID)

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...