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.