python操作 windows 锁屏与锁屏状态判断

pip install ctypes

from ctypes import *
while True:
u = windll.LoadLibrary('user32.dll')
result = u.GetForegroundWindow()
time.sleep(5)
print(result) # 0则表示锁屏

# u.LockWorkStation() 直接锁住
posted @ 2019-12-19 10:27  雷神约  阅读(3356)  评论(0编辑  收藏  举报