:
A system-wide keyboard hook requires a DLL entry. There's a sample keyboard hook code on my website here .
Hooks cannot be installed from a low-integrity application in Vista and Windows 7/8/10. Thus, there is no guarantee that your hook will work, depending on what the foreground application is at the touch of a key.
As Greg noted, a lot of time, RegisterHotKey is a much simpler solution to this problem.
source
share