Relative Content

Tag Archive for pythonpywin32

What does GetClientRec(hwnd) return?

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?

pythonservice.exe crash when run a python script as win10 service after upgrade python version from 3.10 to 3.12. Cannot find the reason

I write a python script used to reversely forward a port. I use pywin32 to convert the python codes as a win10 service. The service runs ok when python version is 3.10. However, after I upgrade the python from version 3.10 to 3.12, The service stop immediatly everytime I start it. I don’t know why. Can anyone give some suggestions? Thanks a lot. The following is my python codes: