Page 1 of 1

Window under Cursor?

Posted: Sat Aug 29, 2009 10:26 am
by nco2k
anyone know an easy way to get the handle of the window under the cursor? the window im dealing with, does not belong to my app.

c ya,
nco2k

Posted: Sat Aug 29, 2009 11:31 am
by SCRJ
Try WindowFromPoint_() :wink:

Posted: Sat Aug 29, 2009 11:32 am
by srod
WindowFromPoint_().

**DOH : too slow! :)

Posted: Sat Aug 29, 2009 11:55 am
by nco2k
i tried that already, but always got zero as result... vista 64. any ideas?

Code: Select all

Repeat
  If GetCursorPos_(@Mouse.POINT)
    Debug WindowFromPoint_(Mouse)
  EndIf
  Delay(1000)
Until GetKeyState_(#VK_ESCAPE) & $8000
c ya,
nco2k

Posted: Sat Aug 29, 2009 11:57 am
by srod

Code: Select all

Repeat 
  If GetCursorPos_(@Mouse.POINT) 
    Debug WindowFromPoint_(Mouse\y<<32 | mouse\x) 
  EndIf 
  Delay(1000) 
Until GetKeyState_(#VK_ESCAPE) & $8000

Posted: Sat Aug 29, 2009 12:02 pm
by nco2k
ok, thanks. :shock:

c ya,
nco2k

Posted: Sat Aug 29, 2009 12:06 pm
by srod
No problem.

WindowFromPoint_() actually takes a point structure as it's parameter rather than a pointer to the structure. That is, it takes a 64-bit argument containing the x and y co-odinates of interest.