4rigener
4rigener

Reputation: 386

How to pop-up minimized program at Taskbar python

What I want to pop-up is minimized at taskbar.

But when I run below code, not minimized program pop-up, one more program run, and it cannot be clicked or seen and simply exists in the taskbar.

import win32gui, win32con


hwnd = win32gui.FindWindow(None, "League of Legends")
win32gui.SetForegroundWindow(hwnd)
win32gui.ShowWindow(hwnd, win32con.SW_SHOW)

What I expected : minimized program pop-up

enter image description here

Upvotes: 2

Views: 1781

Answers (1)

Axois
Axois

Reputation: 2061

Firstly make sure that you are locating the right window using this Finder tool. If you do not have Visual Studio, you can also download Winspector

Next, what you can try is to swap the arguments, for e.g

hwnd = win32gui.FindWindow("League of Legends", None)

Arguments for .FindWindow is className followed by windowName which can be found here

Moreover, you can set specific flags for your window to show.

For example if the initial state is minimized, you can show it by using the SW_SHOWNORMAL flag. Usage is as such, 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.

Upvotes: 1

Related Questions