Sign in to follow this  
Followers 0

WinAPI KB hooks and Menu/Applications key

1 post in this topic

I made a program that changes certain keyboard keys to do different tasks than they are normally for.

One of these is switching to Japanese IME using the right windows key. I figured, I could turn the Menu key into the Kanji switch.

Unfortunately... The same code that works on all my other keys, doesn't work on that specific one.

Temporary workaround, is I'm using BlockInputEx, but I would like to know if there's a more elegant solution.

;Caps Lock Redirects to Tab
If $vkCode = 0x14 Then ;Caps Lock
    If $hkCapsLock = "Tab" Then
        Return -1 ;Prevent trigger key from being sent
ElseIf $vkCode = 0x5c Then ;Right Windows Key
    If $hkRWin = "JP" Then
        _keybd_event(0x12, "") ;Press alt
        _keybd_event(0xA0, "") ;Press left shift
        _keybd_event(0xA0, 0x0002) ;Release left shift
        _keybd_event(0x12, 0x0002) ;Release alt
        Return -1
ElseIf $vkCode = 0x5b Then ;Left Windows Key
    If $hkLWin = "Run" Then
        ;Run Command
        Run(@WindowsDir & "\explorer.exe shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}")
        Return -1
ElseIf $vkCode = 0x5D Then ;Right Menu Key
    If $keyboardLayout = "JPDV" Then
        _keybd_event(0x19, "") ;Press Kanji mode
        _keybd_event(0x19, 0x0002) ;Release Kanji mode
        Return -1 ;Does not function


If you need help with your stuff, feel free to get me on my Skype.

I often get bored and enjoy helping with projects.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0