But it must show "This text must be shown".emrekarahan0001 wrote: ↑if title "Anasayfa / Twitter - Google Chrome"
Get Window Title at Specific Coordinates
-
- Posts: 4411
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Get Window Title at Specific Coordinates
- emrekarahan0001
- Posts: 25
- Joined: 18 Jan 2021, 14:19
Re: Get Window Title at Specific Coordinates
English = **Home** / Twitter - Google Chrometeadrinker wrote: ↑22 Jun 2021, 11:42But it must show "This text must be shown".emrekarahan0001 wrote: ↑if title "Anasayfa / Twitter - Google Chrome"
Turkish = **Anasayfa** / Twitter - Google Chrome
Code: Select all
WinWait, **Home** / Twitter - Google Chrome
-
- Posts: 4411
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Get Window Title at Specific Coordinates
This is a wrong result. If you launch my code, it must show "This text must be shown".emrekarahan0001 wrote: ↑English = **Home** / Twitter - Google Chrome
Turkish = **Anasayfa** / Twitter - Google Chrome
- emrekarahan0001
- Posts: 25
- Joined: 18 Jan 2021, 14:19
Re: Get Window Title at Specific Coordinates
believe me brother, i understand you, but i can't explain to my problem.. whatever thank youteadrinker wrote: ↑22 Jun 2021, 11:51This is a wrong result. If you launch my code, it must show "This text must be shown".emrekarahan0001 wrote: ↑English = **Home** / Twitter - Google Chrome
Turkish = **Anasayfa** / Twitter - Google Chrome
-
- Posts: 4411
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Get Window Title at Specific Coordinates
Can you say, what exactly you need to get?emrekarahan0001 wrote: ↑i can't explain to my problem
Re: Get Window Title at Specific Coordinates
With this window it does not show "This text must be shown". i think the matter with the WindowFromPoint itself. It works in some 32 bit apps, and in some 64 bit apps, but more weirdly - with Telegram app it works on the right side of the app where messages are shown and on the left side where contacts are shown it does not. Interestingteadrinker wrote: ↑22 Jun 2021, 08:40Try this:What the text the message box shows?Code: Select all
Gui, New, -Caption +Border Gui, Margin, 0, 0 Gui, Font, s24 Gui, Add, Edit,, This text must be shown Gui, Show, x497 y497 varSetCapacity(title, 200, 0) DllCall("GetWindowText", "ptr", DllCall("WindowFromPoint", "Int", 500, "Int", 500) , "str", title, "int", 199) msgbox %title% ExitApp
-
- Posts: 4411
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Get Window Title at Specific Coordinates
Yep, under 32 bits i got the correct result. We are trying to get titles for Top windows, not Children - right?
-
- Posts: 4411
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Get Window Title at Specific Coordinates
Nope, the function WindowFromPoint gives you the window handle, within which a point is placed, independing on the type of the window, child or top level. If you need to get the handle of the parent window, you have to call winapi GetAncestor with GA_ROOT.
Re: Get Window Title at Specific Coordinates
As I said, this will not work correctly on x64:
On x64, it is the same as this:Passing the x and y coordinates as individual int parameters works for 32-bit because they are simply pushed onto the stack, right to left, 4 bytes at a time. This would not work with smaller types, because each parameter would be widened to 32-bit. It also would not work for x64 because each parameter (int) would be widened to 64-bit.
Code: Select all
DllCall("WindowFromPoint", "Int64", 500, "Int64", 500)
Code: Select all
DllCall("WindowFromPoint", "Int64", 500)
Re: Get Window Title at Specific Coordinates
swagfag wrote: ↑10 May 2019, 13:34@teadrinker
https://blogs.msdn.microsoft.com/oldnewthing/20101230-00/?p=11873/
last paragraphand x seems to break on negative coords if u dont mask it offCode: Select all
x := y := 500 CWP_ALL := 0x0000 CWP_SKIPINVISIBLE := 0x0001 CWP_SKIPDISABLED := 0x0002 CWP_SKIPTRANSPARENT := 0x0004 hwnd := DllCall("ChildWindowFromPointEx" , "Ptr", DllCall("GetDesktopWindow", "Ptr") , "UInt64", (x & 0xFFFFFFFF) | (y << 32) , "UInt", CWP_SKIPINVISIBLE | CWP_SKIPDISABLED | CWP_SKIPTRANSPARENT , "Ptr")
that aside, these functions behave very weirdly. its says it accepts a POINT BY VALUE, what?? but i triedbut it didnt work. it only checked (0, 0) on my 2 monitor (-1920, 1920) setup, which is the topleft corner of my rhs main monitorCode: Select all
VarSetCapacity(P, 8, 0) NumPut(500, &P, 0, "Int") NumPut(500, &P, 4, "Int") ; ... and passing it BY VALUE , "Ptr", P
this API doesn't work when the window is a child of another window?
Code: Select all
OnMessage(0x200, "WM_MOUSEMOVE")
Global hGui, hGui2
Gui, +hWndhGui
Loop, 5
Gui, Add, Button, w60 h20, G1 %A_Index%
Gui 2: +Parent1 +hWndhGui2 -Caption
Loop, 5
Gui, 2:Add, Button, x50 w60 h20, G2 %A_Index%
Gui, 2:Show, x0 y0
Gui, Show, w400 h300
Return
WM_MOUSEMOVE(wParam, lParam, msg, hWnd) {
X := lParam & 0xFFFF
Y := (lParam >> 16)
FileAppend, X: %X% Y: %Y%`n,*
hWnd := Format("{:#x}", hWnd)
;FileAppend, hGui: %hGui% hWnd: %hWnd%`n,*
CoordMode, Mouse, Client
MouseGetPos, X, Y
FileAppend, X: %X% Y: %Y%`n,*
static CWP_ALL := 0x0000
, CWP_SKIPINVISIBLE := 0x0001
, CWP_SKIPDISABLED := 0x0002
, CWP_SKIPTRANSPARENT := 0x0004
hwnd := DllCall("ChildWindowFromPointEx"
, "Ptr", hGui
, "Int64", (x & 0xFFFFFFFF) | (y << 32)
, "UInt", CWP_ALL
, "Ptr")
hWnd := Format("{:#x}", hWnd)
WinGetClass, WinClass, ahk_id %hWnd%
FileAppend, WinClass: %WinClass% `n,*
FileAppend, => hwnd: %hwnd%`nhGui: %hGui% hGui2: %hGui2%`n`n,*
If (WinClass = "Button")
WinHide, ahk_id %hWnd%
; ==============================================
; ==============================================
Point := (Y << 32) | (X & 0xFFFFFFFF)
hWnd2 := DllCall("ChildWindowFromPointEx", "Ptr", hGui, "Int64", Point, "UInt", 0x05, "UPtr")
hWnd2 := Format("{:#x}", hWnd2)
WinGetClass, WinClass, ahk_id %hWnd2%
FileAppend, WinClass: %WinClass% `n,*
FileAppend, => hwnd2: %hwnd2%`nhGui: %hGui% hGui2: %hGui2%`n`n,*
}
Esc::ExitApp
instead of the control
The return value is a handle to the first child window that contains the point and meets the criteria specified by uFlags. If the point is within the parent window but not within any child window that meets the criteria, the return value is a handle to the parent window. If the point lies outside the parent window or if the function fails, the return value is NULL.
Who is online
Users browsing this forum: adam86shadow, Bing [Bot], Chunjee, JKJadan and 283 guests