Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
all child handles in a RECT
Hello All,
Is there an easy way to get all the visible child window handles in a rect area? i.e. as if you child(mouse) over each pixel in the rect and got the unique set?
Macro Macro2257
Copy      Help
int w=win("" "QM_Editor")
RECT r; SetRect &r 100 0 300 300

RECT rw rc ri
GetClientRect w &rw; MapWindowPoints w 0 +&rw 2 ;;client rect in screen
OffsetRect &r rw.left ;;r in screen
OnScreenRect 1 &r; 1 ;;remove this
ARRAY(int) a; int i
child "" "" w 0x400 "" a
for i 0 a.len
,GetWindowRect a[i] &rc ;;control rect in screen
,if(!IntersectRect(&ri &r &rc)) continue
,outw a[i]
,OnScreenRect 0 &ri; 0.3 ;;remove this
What a nice piece of code!
Thanks for sharing.
This is fantastic. For some reason, for larger rect's that bordered close to another child hwnd, the nearby hwnd would get included, even though it was outside the RECT. I took out the OffsetRect line, and now it works PERFECTLY.
Thank you so much!!!

Forum Jump:

Users browsing this thread: 1 Guest(s)