[python-win32] Unpredictable behavior of pywin32 on new computer
Tim Roberts
timr at probo.com
Mon Oct 10 19:41:50 EDT 2022
Zach York wrote:
>
> I have recently upgraded my computer and after upgrading and
> installing pywin32, I have found the behavior to be extremely
> unpredictable and in a lot of cases, just wrong.
> ...
> My scripts are mostly trying to do some background clicking using
> PostMessage/SendMessage and window resizing/positioning using
> MoveWindow. I used to be able to use SendMessage reliably before this
> computer upgrade, but now it seems like I need a combination of
> PostMessage + SendMessage to see a click at all). For MoveWindow, the
> results are entirely unpredictable (window isn't moved at all, window
> resized and moved to the wrong location, etc).
>
> I assume this has to somehow be with my setup and not pywin32, but I
> am lost on what might be causing this weird behavior. Any insight
> would be greatly appreciated!
If you upgraded your display as well, the problem is probably the
display scaling. Unless you mark your application has being "high DPI
aware", Windows will lie to you about pixel locations. If your display
is 3840x2160, but you have scaling set to 200%, your "non-aware"
application will be told that the display is 1920x1080, and the pixel
coordinates you are sending to other applications will be wrong. Go
read about "high DPI aware" applications. It's a mess.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3428 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mail.python.org/pipermail/python-win32/attachments/20221010/a6f92006/attachment.bin>
More information about the python-win32
mailing list