如何在任务栏弹出最小化程序python
How to pop-up minimized program at Taskbar python
我要弹出的内容在任务栏最小化了。
但是当我运行下面的代码时,没有最小化程序弹出,多了一个程序运行,而且它不能被点击或看到,只是存在于任务栏中。
import win32gui, win32con
hwnd = win32gui.FindWindow(None, "League of Legends")
win32gui.SetForegroundWindow(hwnd)
win32gui.ShowWindow(hwnd, win32con.SW_SHOW)
如我所料:最小化程序弹出窗口
首先确保您使用 Finder tool. If you do not have Visual Studio, you can also download Winspector
找到正确的 window
接下来,您可以尝试交换参数,例如
hwnd = win32gui.FindWindow("League of Legends", None)
.FindWindow
的参数是 className
后跟 windowName
可以找到 here
此外,您可以设置 specific flags 让您的 window 显示。
例如,如果初始状态是最小化的,您可以使用 SW_SHOWNORMAL
标志来显示它。用法是这样的,
win32gui.ShowWindow(hwnd, win32con.SW_SHOWNORMAL)
(SW_SHOW) Activates the window and displays it in its current size and position.
(SW_SHOWNORMAL) Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
我要弹出的内容在任务栏最小化了。
但是当我运行下面的代码时,没有最小化程序弹出,多了一个程序运行,而且它不能被点击或看到,只是存在于任务栏中。
import win32gui, win32con
hwnd = win32gui.FindWindow(None, "League of Legends")
win32gui.SetForegroundWindow(hwnd)
win32gui.ShowWindow(hwnd, win32con.SW_SHOW)
如我所料:最小化程序弹出窗口
首先确保您使用 Finder tool. If you do not have Visual Studio, you can also download Winspector
找到正确的 window接下来,您可以尝试交换参数,例如
hwnd = win32gui.FindWindow("League of Legends", None)
.FindWindow
的参数是 className
后跟 windowName
可以找到 here
此外,您可以设置 specific flags 让您的 window 显示。
例如,如果初始状态是最小化的,您可以使用 SW_SHOWNORMAL
标志来显示它。用法是这样的,
win32gui.ShowWindow(hwnd, win32con.SW_SHOWNORMAL)
(SW_SHOW) Activates the window and displays it in its current size and position.
(SW_SHOWNORMAL) Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.