I am confused about the return value of win32gui.GetClientRec(hwnd).
It returns the actual pixel positions (scale factor: 100%) instead of the scaled pixel positions (scale factor: 150%) of the window.
However when I ask ChatGPT, it insist that GetClientRec returns the scaled pixel positions of a window, I am confused. Could anyone explain how does the method works?
It returns the actual pixel positions (scale factor: 100%) instead of the scaled pixel positions (scale factor: 150%) of the window.
My Code:
hwnd = win32gui.FindWindow("ApplicationWindow", "a")
if hwnd == 0:
print("Error")
left, top, right, bot = win32gui.GetClientRect(hwnd)
w = right - left
h = bot - top
scale_factor = get_scale_factor()
real_w = int(w * scale_factor)
real_h = int(h * scale_factor)
The w and h are the unscaled and I don’t know why.