用python实现禁用硬件?
def BlockInput(bEnable): """ bEnable: True: Disable mouse & keyboard False: Enable mouse & keyboard """ import pyHook def uDisable(event): return False def uEnable(event): return True hm = pyHook.HookManager() if bEnable == True: hm.MouseAll = hm.KeyAll = uDisable else: hm.MouseAll = hm.KeyAll = uEnable hm.HookMouse() hm.HookKeyboard()这里用Python的pyHook模块,写了个类似AutoIt中的BlockInput函数。pyHook是个扩展模块,需要另外下载的,具体用法可以参考pyHook模块中的example.py。
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有