上一篇写了个小程序介绍了运用ACLLib库操作鼠标。现在来分享ACLLib库键盘交互操作如何实现,也写一个小程序,判断键盘按键。
判断键盘按键小程序,运行画面就是下面这个图。
实现方法:
主要用到ACLLib库的键盘回调函数,registerKeyboardEvent(KeyboardEvent);
KeyboardEvent回调函数里面用switch判断是哪个按键。
具体按键值可看这篇:键盘键值对应表
键盘键值宏定义都在这个头文件中 WinUser.h,用ACLLib库时不要再加入到工程,ACLLib库已经#include过。
另外要说明的是0-9,? A-Z? ?并没有定义宏,因为它的键值就ASCII值。(ASCII码表)
当然自己也可以在程序中定义,具体的可以看我下面源代码的部份。
123456 WinUser.h 里面的说明/** VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)* 0x3A - 0x40 : unassigned* VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)*/
运用ACLLib库判断键盘按键源代码:
运用ACLLib库判断键盘执行档:
链接:https://pan.baidu.com/s/1j_SsBaAkosjFMOXkm8G08w
提取码:2dlu
注:运用ACLLib库判断键盘键值可以说是没什么难度,主要是要理解键盘上各个键值定义,不然会很容易混掉。
如果程序只做字符输入检测功能可以运用ACLLib库中的字符事件,registerCharEvent(CharEvent);这样就不用去判断键值的问题,上面运用ACLLib库判断键盘按键源代码中也有字符事件的代码,可以参考。
Really loads of useful tips! fluconazole 100 mg
Terrific forum posts, Regards. canadianpharmacy
You definitely made your point! canadian pharmacies
Wow a lot of excellent advice. is kratom legal
Kudos! I appreciate it. viagra pills
Nicely put. Many thanks. mexican pharmacies shipping to usa
Incredible lots of great data! canada drug pharmacy
You reported that adequately! kratom news
Good posts, Thank you. canadian pharcharmy online
Nicely put. Thank you. Can Cialis Cause Vision Problems
This is nicely expressed! . canadian pharcharmy
Reliable info. Regards. generic viagra
With thanks, Plenty of posts!
https://viagradocker.com/
Beneficial tips. Thanks a lot. generic levitra
Good knowledge. Appreciate it! online pharmacies of canada
Very well expressed truly! ! buy viagra
Good posts. Thanks a lot! hydroxyzine generic
Thanks a lot, Ample stuff!
north west pharmacy canada
Wonderful facts. Many thanks. side effects for modafinil
Nicely put. Appreciate it! viagra pills