Posts: 43
Threads: 21
Joined: Feb 2013
Hi Gintaras,
The code below does not work when CAPSlock is on.
Is there a virtual keycode for this situation? I tried to use your example with the
etWindowsHookEx to see what keycodes are generated, but I did not see a code produced in this case. Is there any solution at all ?
Function
Volume_Mixer_Up_Down
rep
,0.02
,ifk (0x26) ;; UP
,...
Regards,
Gert
Posts: 12,079
Threads: 141
Joined: Dec 2002
The reason could be:
Keyboard driver. Try with a different keyboard.
Something in your other macros. Try with empty QM file.
Some other software.
ifk uses API GetKeyState. Also there is GetAsyncKeyState.
Macro
Macro267
rep
,0.02
,if GetKeyState(VK_UP)&0x8000
,,out "GetKeyState says: Up Arrow is pressed"
,if GetAsyncKeyState(VK_UP)&0x8000
,,out "GetAsyncKeyState says: Up Arrow is pressed"
,,
SetWindowsHookEx is the most powerful, most low-level. If it does not see the key event, I don't know other solutions.
Posts: 43
Threads: 21
Joined: Feb 2013
Gintaras, it works now, thanks to your tip to try with an empty QM file. Because the ifk U had been functioning fine for some time (without CAPSlock On) I thought CAPSlock did change the keycode.
Here's the situation: Using CAPSlock and it's led to change the keyboard behavior.
For some MIDI application it would come in handy to have some keys become HotKeys. Using CAPSlock (and a FF) for this purpose comes in handy because you immediately know the state of your keyboard thanks to the Caps_led.
However now ifk U stopped functioning so I thought that CAPSlock must have changed the keycode. Only after experimenting with your tip I found out that CAPSlock wasn't the culprit, it was the combination of CAPSlock and 'eat'.
I had all the HotKey trigger functions standard 'eat' their key in order to not inadvertently inject something in e.g. the QM editor. However after implementing this CAPSlock idea it appeared that ifk U and ifk D did not get their keys anymore while CAPSlock was On. Now after unticking 'eat' in the two trigger functions it all works again like I was used to.
Thanks for you help !
GertC
Posts: 12,079
Threads: 141
Joined: Dec 2002
GetKeyState (and ifk) has this problem: If a trigger "eats" a key, GetKeyState does not know that the key is physically pressed. Unless is unchecked Options -> Triggers -> Low-level hook -> Keyboard, which is not recommended.
For example, if the macro has trigger Up Arrow, "Eat" checked, "When released" unchecked, ifk U in it will not work. Uncheck "Eat" or check "When released".