我的膝上型计算机有几台垫子,但它没有一台NumLock钥匙,而且该垫子实际上只是上面数字的翻版。 在我发布这些钥匙时发出的虚拟关键守则证实了这一点。
在压力下的关键和固定数字时,我试图制定一项小型方案,以清除斜线编码。 我使用的是低层键盘(我有类似的格式在另一个方案中工作),首先检查一下,看看是否有一条带钥匙。 如果是的话,我通过《科索沃法典》0x30-0x39(0-9条钥匙)。 如果其中一人在此刻被击落,我就放弃了实际的中风,退回了价值1的数值,而是发送了该钥匙的金字塔(此时此刻仍在 press下)。
I can confirm that the hook is being reached, and that the alt key being down is being recognized successfully. However, when I check for matches on 0-9, either only a couple are printed before nothing matches after that, or I have to lift up and press down the alt key every time I press a number. Additionally, one number may be printed 16 times after releasing alt having pressed a number, and then holding down alt and pressing another (this one is 16x).
此外,我可以通过复制从头ook中复制件来证实SendInput序列的工作,将其置于主要功能中,并以0x30取代。 文本文件一经编辑,就会打上0字。
在文本文件中将ALT(down)+6+5+ALT(up)搁置下来时,“65”就是所显示的。 如果加上另一个异常低价竞标+6,则有166个。
Hook Procedure:
LRESULT CALLBACK proc (int code, WPARAM wParam, LPARAM event) //hook proc
{
if (code < HC_ACTION) //don t process if not meant to
return CallNextHookEx (0, code, wParam, event);
if (GetAsyncKeyState (VK_MENU) & 0x8000) //if either alt is down
{
for (int i = 0x30; i <= 0x39; ++i) //loop 0-9
{
if (GetAsyncKeyState (i) & 0x8000) //if index is down
{
cout << "MATCH
"; //debug
input.ki.wVk = i + 0x30; //set VK code to numpad version of index
input.ki.dwFlags = 0; //key is being pressed
SendInput (1, &input, sizeof (INPUT)); //send keystroke down
input.ki.dwFlags = KEYEVENTF_KEYUP; //key is being released
SendInput (1, &input, sizeof (INPUT)); //send keystroke up
while (GetAsyncKeyState (i) & 0x8000) //wait for normal key to be released
Sleep (10); //don t hog CPU
return 1; //discard normal key
} //end if match
} //end for
} //end if alt
return CallNextHookEx (0, code, wParam, event); //if any key not handled, pass on
} //end function