我想要弹出的内容在任务栏最小化。
但是当我运行下面的代码时,没有最小化程序弹出窗口,又运行了一个程序,并且无法单击或看到它,只是存在于任务栏中。
import win32gui, win32con
hwnd = win32gui.FindWindow(None, "League of Legends")
win32gui.SetForegroundWindow(hwnd)
win32gui.ShowWindow(hwnd, win32con.SW_SHOW)
我所期望的:最小化程序弹出窗口
最佳答案
首先确保您使用此 Finder 找到正确的窗口工具。如果没有Visual Studio,也可以下载Winspector
接下来,您可以尝试交换参数,例如
hwnd = win32gui.FindWindow("League of Legends", None)
.FindWindow
的参数是 className
后跟 windowName
,可以找到 here
此外,您还可以设置 specific flags让您的窗口显示。
例如,如果初始状态最小化,您可以使用 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.
关于python - python 如何在任务栏弹出最小化程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57471178/