function xinhanshu(daima, canshu1,canshu2: Integer): Integer;stdcall;
var
msg:TMsg;
begin
if daima<0 then
begin
Result:=CallNextHookEx(form1.jubing,daima,canshu1,canshu2);
Exit;
end;
MoveMemory(Pointer(msg),Pointer(canshu2),28);
if msg.message=256 then
begin
ShowMessage(IntToStr(msg.wParam));
end;
Result:=CallNextHookEx(form1.jubing,daima,canshu1,canshu2);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
jubing:=SetWindowsHookExA(3,xinhanshu,0,GetWindowThreadProcessId(Handle,0));
end;代码目标 在窗口下 拦截键盘按键信息 ,,, 钩子 不知道那里错了 高手给修改一下把
var
msg:TMsg;
begin
if daima<0 then
begin
Result:=CallNextHookEx(form1.jubing,daima,canshu1,canshu2);
Exit;
end;
MoveMemory(Pointer(msg),Pointer(canshu2),28);
if msg.message=256 then
begin
ShowMessage(IntToStr(msg.wParam));
end;
Result:=CallNextHookEx(form1.jubing,daima,canshu1,canshu2);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
jubing:=SetWindowsHookExA(3,xinhanshu,0,GetWindowThreadProcessId(Handle,0));
end;代码目标 在窗口下 拦截键盘按键信息 ,,, 钩子 不知道那里错了 高手给修改一下把
http://download.csdn.net/source/1899084
var
msg:TMsg;
begin
if daima<0 then
begin
Result:=CallNextHookEx(form1.jubing,daima,canshu1,canshu2);
Exit;
end;
Msg := PMsg(canshu2)^;
//MoveMemory(Pointer(msg),Pointer(canshu2),28);
if msg.message=256 then
begin
ShowMessage(IntToStr(msg.wParam));
end;
Result:=CallNextHookEx(form1.jubing,daima,canshu1,canshu2);
end;procedure TForm1.FormCreate(Sender: TObject);
begin
jubing:=SetWindowsHookExA(3,xinhanshu,0,GetWindowThreadProcessId(Handle,nil)); //nil
end;
谢谢 bdmh