WoodGrain Posted December 2, 2015 Posted December 2, 2015 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!
JohnOne Posted December 2, 2015 Posted December 2, 2015 Try SWP_NOACTIVATE AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
WoodGrain Posted December 2, 2015 Author Posted December 2, 2015 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))
KaFu Posted December 2, 2015 Posted December 2, 2015 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) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
WoodGrain Posted December 3, 2015 Author Posted December 3, 2015 Thanks KaFu!Setting to TOPMOST then setting to NOTOPMOST sis the trick
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now