There is a solution here:
http://www.autohotke...topic21703.html
; Get the index of the monitor containing the specified x and y co-ordinates. GetMonitorAt(x, y, default=1) { SysGet, m, MonitorCount ; Iterate through all monitors. Loop, %m% { ; Check if the window is on this monitor. SysGet, Mon, Monitor, %A_Index% if (x >= MonLeft && x <= MonRight && y >= MonTop && y <= MonBottom) return A_Index } return default }
But I think it's not perfect, it only checks a point. It can't be used to check a window is in which monitor. From my understanding, because a window can span two or even more monitors, the question is actually to find out most part of a window is in which monitor. If most part of a window is in monitor 0, then the window in monitor 0; etc.
I think it is very complicated to calculate most part of a window is in which monitor even for dual monitors. Because dual monitors can be following arrangement:
Not to mention multi (2+) monitors.
I want to know if there is some AHK function to check a window is in which monitor? Or can I call some Windows API to achieve this?
Thank you very much.