Window under Cursor?

Just starting out? Need help? Post your questions and find answers here.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Window under Cursor?

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
SCRJ
User
User
Posts: 93
Joined: Sun Jan 15, 2006 1:36 pm

Post by SCRJ »

Try WindowFromPoint_() :wink:
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

WindowFromPoint_().

**DOH : too slow! :)
I may look like a mule, but I'm not a complete ass.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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
I may look like a mule, but I'm not a complete ass.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

ok, thanks. :shock:

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
Post Reply