I'm trying to register certain hotkeys, but I can't because they are Windows defaults.
CTRL+WIN+1 minimizes the current window. I'd like it to do something else.
I'd like to completely disable WIN+LEFT/RIGHT.
I'm also trying to handle the CTRL+WIN+Arrow in my own virtual desktop manager.
This has to be done using c# and Win32 API if necessary. It absolutely cannot use Autohotkey.
Every page I find descibes how this can be done with AutoHotKey.
I'd post code, but I really don't know where to start. I use Win32 to register hotkeys. I assume there is a way to override them, but I can't find any info.
Does anyone have an idea?
It is possible to do this using a keyboard hook. A good hook class for this can be found on this CodeProject Article
Using the below code will prevent the WIN+LEFT or WIN+RIGHT from occurring. You can use this to override whichever keys you'd like.
This will even override hotkeys which you added via
RegisterHotKey
Win API.Once you have those classes in your project you can add handlers to the static
HookManager
class like below.You can also add mouse events, but for simplicity I'm just showing the keyboard hook.
I've also created a generic list so that I know which keys are currently down and I remove those keys from the list on the
KeyUp
event.