How To Get Handle For A Specific Application Window In Python Using Pywin32?
I am attempting to modify some Python code that takes a screenshot of a particular application window in Windows 10. I am trying to use the win32ui / win32gui modules from the pywi
Solution 1:
You can use EnumWindows()
,this will search all the window,Read it in MSDN doc:
import win32gui
def getShell():
thelist = []
def findit(hwnd,ctx):
if win32gui.GetWindowText(hwnd) == "Windows PowerShell": # check the title
thelist.append(hwnd)
win32gui.EnumWindows(findit,None)
return thelist
b = getShell()
print(b) # b is the list of hwnd,contains those windows title is "Windows PowerShell"
Post a Comment for "How To Get Handle For A Specific Application Window In Python Using Pywin32?"