When using the win32api from pywin, I am getting incorrect values for the cursor position. My screen's resolution is 1920x1080, but when I use GetCursorPos() I have (0,0) in the top left and (1535,863) in the bottom right. The code I am using is as follows:
import win32api
def getCursor():
print win32api.GetCursorPos()
I am trying this using python 2.7 on windows 10, but I was also getting this error in python 2.6 on windows 8. Is there any solution or workaround to this problem?
You are subject to DPI virtualization. Your application has not declared itself aware of high DPI and you have a font scaling of 125%.
If you want to avoid DPI virtualization either add the high DPI aware option to the application manifest or call either SetProcessDPIAware
or SetProcessDPIAwareness
.