I need all kind of mouse / keyboard / window messages.
For example following simple Delphi code is quite impossible. It captures (and eats) all right mouse clicks. No matter what component is under mouse.
[...]
True, it is not currently possible.
TOnUserInputEvent in Application lets you see and react to all mouse events. Unfortunately it does not let you "eat" or filter out the events.
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.AddOnUserInputHandler(@UserInputHandler);
end;
procedure TForm1.UserInputHandler(Sender: TObject; Msg: Cardinal);
begin
...
end;
There are other Application.AddOn... methods for other events, too.
It should be possible to extend OnUserInputEvent + handler to take a var param which you can change.
If you want to dive into LCL events and create a patch for such feature, I think it can be applied.
How much work or side-effects it causes, I have no idea.