Summary for myself Updated from time to time
** I just need to know myself, so the terms may be wrong in some places **
!! View
#command
#Argument option description
I wonder if I often use it when getting windows
import win32gui
#Get window handle by window title
win32gui.FindWindow()
#The first argument is the class name, otherwise None
#The second argument is the title name
#Get the window handle of the foreground window
win32gui.GetForegroundWindow()
#Get the position of the window
rect = win32gui.GetWindowRect()
#Argument window handle
#The return value is
#rect[0]Top left of screen x coordinate
#rect[1]Upper left y coordinate of the screen
#rect[2]Bottom right of screen x coordinate
#rect[3]Bottom right of screen y coordinate
Recommended Posts