Otra alternativa a TApplicationEvents, es desviar en nuestra aplicación el proceso de los mensajes recibidos tal como:
Código Delphi
[-]
private
FClientInstance : TFarProc;
FPrevClientProc : TFarProc;
procedure TFormMain.FormCreate(Sender: TObject);
begin
FClientInstance := MakeObjectInstance(ClientWndProc);
FPrevClientProc := Pointer(GetWindowLong(ClientHandle,GWL_WNDPROC));
SetWindowLong(ClientHandle,GWL_WNDPROC, LongInt(FClientInstance));
end;
procedure TFormMain.ClientWndProc(var Message: TMessage);
var
Dc : hDC;
Row,col: Integer;
Bit : TBitmap;
begin
with Message do
case Msg of
WM_KEYDOWN:
ProcesarTeclado(Message);
bla, bla bla....
Result := 1;
end;
else
Result := CallWindowProc(FPrevClientProc,
ClientHandle,
Msg,
wParam,
lParam);
end;
end;