Найти - Пользователи
Полная версия: Определить используется ли в данный момент диалоговое окно
Начало » Python для новичков » Определить используется ли в данный момент диалоговое окно
1
gelius
Код определяет запущен ли в данный момент указанный процесс:
 import psutil
def check_python_program(program_name):
    for proc in psutil.process_iter():
        try:
            if proc.name() == program_name:
                return True
        except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
            pass
    return False
if check_python_program("msedge.exe"):
    print("Программа запущена.")
else:
    print("Программа не запущена.")
Процесс ‘микрософт едж’ всегда запущен в фоне, получится определить используется в данный момент окно браузера или нет?
michaelarrington
This code is a simple and efficient way to check if a process, such as msedge.exe, is running using the psutil library. However, as noted, Microsoft Edge often runs in the background (e.g. due to notifications or updates), making it more difficult to determine the usage of the active browser window. Sprunki Pyramixed
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB