Home > Net >  How to detect right-click on a TMenuItem with WM_MENURBUTTONUP?
How to detect right-click on a TMenuItem with WM_MENURBUTTONUP?

Time:11-22

In a 32-bit Delphi 11 VCL Application on Windows 10, I use a TApplicationEvents component to catch Windows Messages. Unfortunately, TApplicationEvents seems to not react to the WM_MENURBUTTONUP message when I RIGHT-CLICK on a TPopupMenu MenuItem:

procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
begin
  case Msg.message of
      Winapi.Messages.WM_MENURBUTTONUP: CodeSite.Send('TForm1.ApplicationEvents1Message: WM_MENURBUTTONUP');
  end;
end;

The Screen recording of example application showing RMB clicks in the main menu and two different context menus.

  • Related