AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Windows on top of eachother: Z coord?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ulti



Joined: 08 Dec 2009
Posts: 18

PostPosted: Sun Dec 20, 2009 11:28 pm    Post subject: Windows on top of eachother: Z coord? Reply with quote

If you take all the windows that exist on your screen, you could say they all have a Z-coordinate ( dimension of depth).
Is there a way to specify the Z-coord of a certain window?


An example of my case:

I have 5 windows stacked on eachother and when the visible window contains a certain pixel, it will be moved away from the stack to the right.
Then i do an action on the window and it should be moved back to the stack on the left, but to the very back of this stack.
However, when i just use WinMove, it will move the window to the front of the stack ( since it's also activated ).

So is there a way to move it to the back of the stack?
Back to top
View user's profile Send private message
Micahs



Joined: 01 Dec 2006
Posts: 460

PostPosted: Mon Dec 21, 2009 12:16 am    Post subject: Reply with quote

You could use the 'SetWindowPos' API call. You can't specify a position, but you provide an hwnd to insert after.
_________________
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Dec 21, 2009 12:55 am    Post subject: Reply with quote

This thread might help as well - Changing a window's Z position (not top or bottom)
Back to top
Micahs



Joined: 01 Dec 2006
Posts: 460

PostPosted: Mon Dec 21, 2009 12:59 am    Post subject: Reply with quote

This will place the gui behind the active window when you press Esc. (Obviously, our gui can't be the active one or it won't do anything!)

Code:
SWP_NOMOVE=0x2   ;These are flags for 'setWindowPos' use these as necessary
SWP_NOSIZE=0x1
SWP_NOACTIVATE=0x10
SWP_SHOWWINDOW=0x40
SWP_NOZORDER=0x4
SWP_FRAMECHANGED=0x20

Gui, +LastFound
Gui, Add, Text,, Press 'Esc' to place this window behind the active window
Gui, Show, NA
guiID := WinExist()

Return

Esc::
   aID := WinExist("A")   ;get the id of the active window
   gx := 0   ;we are using 'SWP_NOMOVE' and 'SWP_NOSIZE' so the size and pos can be null.
   gy := 0
   gw := 0
   gh := 0
   ret1 := DllCall("SetWindowPos", "UInt", guiID, "UInt", aID, "Int", gx, "Int", gy, "Int", gw, "Int", gh, "UInt", SWP_NOACTIVATE|SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE)
Return

_________________
Back to top
View user's profile Send private message
ulti



Joined: 08 Dec 2009
Posts: 18

PostPosted: Wed Dec 23, 2009 12:11 pm    Post subject: Reply with quote

Thanks for the help guys.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group