I was trying to capture Shift+PrintScreen as Ctrl+c was captured in this answer.
Although the answer is outdated, but even if I fix the import, it doesn't works:
import pythoncom
from pyHook import HookManager, GetKeyState, HookConstants
def OnKeyboardEvent(event):
ctrl_pressed = GetKeyState(HookConstants.VKeyToID('VK_CONTROL') >> 15)
if ctrl_pressed and HookConstant.IDToName(event.keyId) == 'd':
print("ctrl plus d was pressed at same time")
return True
# create a hook manager
hm = HookManager()
# watch for all keyboard events
hm.KeyDown = OnKeyboardEvent
# set the hook
hm.HookKeyboard()
# wait forever
pythoncom.PumpMessages()
I wanted to capture PrintScreen key and open my Screenshot application, which I was able to do. Now I want to capture Shift + PrintScreen and open my application with some other config. How can I capture both key at once?