Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No enumerators available" - on Windows 10 #30

Open
feerrenrut opened this issue Apr 11, 2020 · 4 comments · May be fixed by #32
Open

"No enumerators available" - on Windows 10 #30

feerrenrut opened this issue Apr 11, 2020 · 4 comments · May be fixed by #32

Comments

@feerrenrut
Copy link

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

@hhannine
Copy link
Contributor

Do you get this error on older versions of screeninfo? Would you mind sharing what values the variable dc_full gets?

@hhannine
Copy link
Contributor

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?

@feerrenrut
Copy link
Author

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 fails NULL 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 in ReleaseDC(None, dc_full) fixes the error for me.

@hhannine
Copy link
Contributor

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.

feerrenrut added a commit to feerrenrut/screeninfo that referenced this issue Apr 13, 2020
Fixes rr-#30

dc_full is a pointer, if interpretted as a signed number may be negative. Null -> 0 indicates failure.
Set return types for foriegn function so return value can be compared to
None.

ReleaseDC was not being called with enough arguments, it should also
take the same Window Handle (HWND) as GetDC.
@feerrenrut feerrenrut linked a pull request Apr 13, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants