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 

window under the window under the mouse-cursor

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



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Thu Mar 10, 2005 12:14 am    Post subject: window under the window under the mouse-cursor Reply with quote

Hi,

it sounds funny, but is it possible to get the window-id of the window behind the window where the mouse-pointer is? Now I hide the window under the mouse, get the window-id and then show the hidden window. That works, but looks ugly.

Tekl
Back to top
View user's profile Send private message Visit poster's website
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Thu Mar 10, 2005 12:17 am    Post subject: Reply with quote

Is this what you're looking for:
MouseGetPos, [OutputVarX, OutputVarY, OutputVarWin, OutputVarControl, 1]
_________________

Back to top
View user's profile Send private message Visit poster's website
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Thu Mar 10, 2005 12:42 am    Post subject: Reply with quote

Hi Titan,

maybe you've misunderstood me. I don't want the window under the mouse. I want the window covered by the window under the mouse.

Tekl
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Thu Mar 10, 2005 12:44 am    Post subject: Reply with quote

He wanted the window *behind* the one the mouse is hovering over.

The following script seems to work. It relies on the fact that "WinGet List" probably always retrieves its window in z-order, which is the order they are stacked on the desktop:
Code:
#space::  ; Win+Space hotkey.
CoordMode, Mouse
MouseGetPos, MouseX, MouseY
; 123321 is intentionally a non-existent window for compatibility with older AutoHotkey versions:
WinGet, List, List,,, 123321

FirstWindowFound := false
FoundID =

Loop %List%  ; For each window on the desktop.
{
   ID := List%A_Index%
   WinGetPos, WinX, WinY, WinW, WinH, ahk_id %ID%
   ; Does the mouse cursor lie inside the boundary of this window?:
   if (MouseX > WinX and MouseY > WinY and MouseX < WinX+WinW and MouseY < WinY+WinH)
   {
      ; Mouse is inside this window's boundaries.
      if FirstWindowFound
      {
         FoundID := ID  ; The second window in the z-order has been found.
         break
      }
      else
         FirstWindowFound := true  ; Now we want the second window.
   }
}

if FoundID
{
   WinGetTitle, FoundTitle, ahk_id %FoundID%
   MsgBox The following window is underneath the mouse cursor's top window:`n%FoundTitle%
}
return
Back to top
View user's profile Send private message Send e-mail
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Thu Mar 10, 2005 11:41 am    Post subject: Reply with quote

Thanks Chris, that's really nice.

Tekl
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   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