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

Python 3.7+ no longer supports win32gui #6

Open
Fireflaker opened this issue Jul 24, 2020 · 2 comments
Open

Python 3.7+ no longer supports win32gui #6

Fireflaker opened this issue Jul 24, 2020 · 2 comments

Comments

@Fireflaker
Copy link

Any other way to do it?
win32api?

@aslily1234
Copy link

you can try this one ~

from ctypes import *
HWND_BROADCAST = 0xffff
WM_SYSCOMMAND = 0x0112
SC_MONITORPOWER = 0xF170
MonitorPowerOff = 2
SW_SHOW = 5
windll.user32.PostMessageW(HWND_BROADCAST, WM_SYSCOMMAND,
                           SC_MONITORPOWER, MonitorPowerOff)
shell32 = windll.LoadLibrary("shell32.dll")
shell32.ShellExecuteW(None, 'open', 'rundll32.exe',
                      'USER32', '', SW_SHOW)

@hagrid67
Copy link
Contributor

pip install pywin32

worked for me on Windows 10, with python 3.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants