Anyone knows this?

04/10/2008 09:38 warriorchamp#1
Anyone knows what does the ControlFromPoint(X, Y, "ahk_id " id2,"", cX, cY) function in AHK? (X, Y, cX, cY are coordinates (cX, cY are not sure)). I didn't find it in the command list.
04/10/2008 17:21 evanxxxm#2
yea sure i can answer u
the whole line is
Code:
    [COLOR="Red"]hwnd [/COLOR]:= [COLOR="Blue"]ControlFromPoint[/COLOR](X, Y, "ahk_id " id,"", cX, cY)
    PostMessage, 0x201, 0x8 | 0x1, cX & 0xFFFF | (cY & 0xFFFF) << 16,, ahk_id %[COLOR="Red"]hwnd[/COLOR]%
    PostMessage, 0x202, 0x8      , cX & 0xFFFF | (cY & 0xFFFF) << 16,, ahk_id %[COLOR="Red"]hwnd[/COLOR]%
return
return

[COLOR="Blue"]ControlFromPoint[/COLOR](X, Y, WinTitle="", WinText="", ByRef cX="", ByRef cY="", ExcludeTitle="", ExcludeText="")
{
    if !([COLOR="Red"]hwnd [/COLOR]:= WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText))
        return false
    
    VarSetCapacity(pt,8)

    VarSetCapacity(wi,60), NumPut(60,wi)
    DllCall("GetWindowInfo","uint",hwnd,"uint",&wi)
    NumPut(X + (w:=NumGet(wi,4,"int")) - (cw:=NumGet(wi,20,"int")), pt,0)
    NumPut(Y + (h:=NumGet(wi,8,"int")) - (ch:=NumGet(wi,24,"int")), pt,4)
    
    Loop {
        child := DllCall("ChildWindowFromPointEx","uint",hwnd,"int64",NumGet(pt,0,"int64"),"uint",0x5)
        if !child or child=hwnd
            break
      
        DllCall("MapWindowPoints","uint",hwnd,"uint",child,"uint",&pt,"uint",1)
        hwnd := child
    }
    cX := NumGet(pt,0,"int")
    cY := NumGet(pt,4,"int")
    return [COLOR="Red"]hwnd[/COLOR]
}
Controlfrompoint is a function name that u declare
u can change it to whatever u want, even abc will work (but need to change both together)
same as hwnd