用TApplicationEvents控件拦截系统WM_KEYDOWN消息 参考: procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); begin if Msg.message=WM_KEYDOWN then begin //在Edit和Memo下按小键盘时不作处理,你自己可以过滤其它控件 if not (Self.ActiveControl is TEdit) and not (Self.ActiveControl is TMemo) then begin Case Msg.wParam) of 96: //小键盘0 ,快捷键要完成的功能在这里写 97: //小键盘1 98: 99: 100: 101: 102: 103: 104: 105://小键盘9 end; end; end; end;
参考:
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if Msg.message=WM_KEYDOWN then
begin
//在Edit和Memo下按小键盘时不作处理,你自己可以过滤其它控件
if not (Self.ActiveControl is TEdit) and
not (Self.ActiveControl is TMemo) then
begin
Case Msg.wParam) of
96: //小键盘0 ,快捷键要完成的功能在这里写
97: //小键盘1
98:
99:
100:
101:
102:
103:
104:
105://小键盘9
end;
end;
end;
end;