2

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

7 Comments

If program not be minimized just behind other windows, then my code work normally.
Use other flags such as SW_SHOWNORMAL
That's samse as SW_SHOW
I search google for 12 hours, but i can't find what i expected. And I'm korean. There's no korea documents, and I'm not familiar with english. I just 23. Sorry, I can't understand specific flags with my situation
If you would like your minimized program to pop up from its minimized state, instead of using win32gui.ShowWindow(hwnd, win32con.SW_SHOW) use win32gui.ShowWindow(hwnd, win32con.SW_SHOWNORMAL)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.