screeninfo
screeninfo copied to clipboard
"No enumerators available" - on Windows 10
Getting a No enumerators available
error.
- Windows 10
- Python 3.7.3
- screeninfo version - 0.6.3
The exception being raised in get_monitors
is
Procedure probably called with not enough arguments (4 bytes missing)
This is coming from the EnumDisplayMonitors
call in enumerators\windows
Originally posted by @feerrenrut in https://github.com/rr-/screeninfo/issues/27#issuecomment-611994044
Do you get this error on older versions of screeninfo? Would you mind sharing what values the variable dc_full gets?
I'm not reproducing this issue on Win10 with Python 3.8.1. @feerrenrut , would you either describe your setup in more detail or try python 3.8.1?
This is the only version of screeninfo I have tried and on Python 3.7.3. I've worked around the issue in the application that was failing for me.
However, looking at this again I can see a few problems. Rectifying them fixes the issue for me.
- For me,
dc_full
had a value of-16704030
. The docs for GetDC specify that if it failsNULL
will be returned. Rather than checking the value is greater than 0, it should be checked against None or 0 (I'd have to verify what ctypes does in this case) - The call to releaseDC is incorrect the docs for ReleaseDC suggest it should take two params
int ReleaseDC( HWND hWnd, HDC hDC)
. Passing inReleaseDC(None, dc_full)
fixes the error for me.
Thanks for looking into it. Would you mind posting your changes so I could test them? Or submit a PR? Since I can't reproduce the problem I can't do more right now.