Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2008
    Messaggi
    1,316

    Py27 Win / Trovare finestra sottoposta

    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?

  2. #2
    Utente di HTML.it
    Registrato dal
    Jun 2008
    Messaggi
    1,316
    Risolto grazie a RicPol, di un famoso forum di python con: https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.