Utilizzo questa mia funzione per trovare la finestra che sta "sotto" a quella sovrapposta:
codice:
def getHwndsForPid(pid):
def callback(hwnd, hwnds):
if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
_, foundPid = win32process.GetWindowThreadProcessId(hwnd)
if foundPid == pid:
hwnds.append(hwnd)
return True
## End def callback
hwnds = []
win32gui.EnumWindows(callback, hwnds)
return hwnds
def getTableByPos(left, top):
for proc in psutil.process_iter():
for hwnd in getHwndsForPid(proc.pid):
for tblName in tblNames:
tblTitle = (win32gui.GetWindowText(hwnd)).strip()
if re.search(tblName, tblTitle):
tblLeft, tblTop, tblRight, tblBottom = win32gui.GetWindowRect(hwnd)
if tblLeft < left and tblTop < top and tblRight > left and tblBottom > top:
return [hwnd, tblLeft, tblTop, tblRight, tblBottom]
Esiste già qualche metodo delle librerie win32/ctypes?