def get_all_hwnd(hwnd, mouse): if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd): hwnd_title.update({hwnd: win32gui.GetWindowText(hwnd)})
def callback(hwnd, hwnds): if win32gui.IsWindow(hwnd) and win32gui.IsWindowVisible( hwnd) and win32gui.IsWindowEnabled(hwnd): if win32gui.GetWindowText(hwnd) == title: win32gui.SetForegroundWindow(hwnd) return
def foo(hwnd, mouse): titles = globalvar.get_value('titles') if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled( hwnd) and win32gui.IsWindowVisible(hwnd): titles.add(win32gui.GetWindowText(hwnd)) globalvar.set_value('titles', titles)
def callback(hwnd, hwnds): if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd): _, found_pid = win32process.GetWindowThreadProcessId(hwnd) if found_pid == pid: hwnds.append(hwnd) return True
def get_visible_hwnds(hwnd, mouse): if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled( hwnd) and win32gui.IsWindowVisible(hwnd): titles.append(win32gui.GetWindowText(hwnd))
def isRawWindow(hwnd): return not win32gui.IsWindowVisible(hwnd) or not win32gui.IsWindowEnabled(hwnd) or ctypes.windll.user32.IsHungAppWindow(hwnd)
def get_all_hwnd(hwnd, mouse): if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled( hwnd) and win32gui.IsWindowVisible(hwnd): mainFormList.update({hwnd: win32gui.GetWindowText(hwnd)}) # 更新mainFormList
try: pro = subprocess.Popen('calc') except Exception as msg: print(msg) try: CSV = list(csv.reader(open('Sample.csv'))) except Exception as msg: pro.kill() print("Cannot open the CSV file or file not found!") time.sleep(1) WDHWD = win32gui.FindWindow(None, "Calculator") if win32gui.IsWindowVisible(WDHWD) and win32gui.IsWindowEnabled(WDHWD): # Get all the sub-windows of the Calc win32gui.EnumChildWindows(WDHWD, add_controls, None) time.sleep(1) win32gui.SetForegroundWindow(WDHWD) time.sleep(1) if len(CSV) != 0: # Explore every row of the CSV file for row in range(len(CSV)): print("now counting row " + str(row)) res = False #Keep False until clicked '=' on the Calculator # Explore elements in a row of CSV file for element in CSV[row]:
def callback(hwnd, hwnds): if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd): hwnds = hwnds.append(hwnd)
def foo(hwnd, mouse): if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled( hwnd) and win32gui.IsWindowVisible(hwnd): titles.add(win32gui.GetWindowText(hwnd))
def all_hwnd(hwnd, mouse): hwnd_windows = dict() if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd): hwnd_windows.update({hwnd: win32gui.GetWindowText(hwnd)}) return hwnd_windows
def get_all_hwnd(hwnd, mouse): if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd): this_title = win32gui.GetWindowText(hwnd) if title == this_title: hwnds.append(hwnd)
def get_all_hwnd(hwnd, mouse): if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd): title = win32gui.GetWindowText(hwnd) if title: window.update({hwnd:title})
def callback(hwnd, hwnds): if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd): hwnds[win32gui.GetClassName(hwnd)] = hwnd return True
def callback(hwnd, hwnd_list: list): title = win32gui.GetWindowText(hwnd) if win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd) and title: hwnd_list.append((title, hwnd)) return True