Detect when a + (Plus) key or = (equal) key has been pressed
Posted on 2006-10-29
It seemed like such a simple thing to do. In PreTranslateMessage(), just look for the WM_KEYDOWN message, then look in wParam for one of the values. Only when I look in Winuser.h, there is no value for VK_EQUAL or anything like it. There is a value for VK_ADD which I assume to be the value passed when the + sign on the numeric keypad is pressed. (I am out of the country, and using my laptop which has no keypad so I can't, at this point, be certain.) When I press the +/= key at the top of the keyboard, it returns a 0xBB. When I look in Winuser, there is no VK_???? that is equal to 0xBB.
Of course, I can catch the 0xBB, look for whether the shift key is pressed, and resolve the keystroke. That is not a problem at all. My question, is there a better way? Is there another mneumonic or manifest that I am missing. For all of the obvious reasons, it seems sort of jack-leg to resort to this.
One last thing, I need to catch the keystrokes very early in the process because the keystroke entered has very different results based on which control has focus at the time that the key is pressed.
Thanks in advance, Rick