来自:beta, 时间:2002-6-21 23:56:00, ID:1176594 | 编辑
在 Application 的 OnMessage 里面捕捉:
Application.OnMessage := ApplicationMessage;
...
procedure TForm1.ApplicationMessage(var Msg: tagMSG
var Handled: Boolean);
begin
if (Msg.message = wm_KeyDown) and (Msg.wParam = vk_Return) and
(ActiveControl is TDBEdit) then
begin
ShowMessage('捕捉到了,来自:' + ActiveControl.Name);
Handled := True
// 表示不发送回去,可根据自己需要设定该值
end;
end;