Check if a TMainMenu is dropped down or not

Spread the love

Check if a TMainMenu is dropped down or not

type
  TForm1 = class(TForm)
    // ...
  private
    IsMenuOpen: Boolean;
    procedure WMMENUSELECT(var message: TWMMENUSELECT); message WM_MENUSELECT;
  end;

implementation

procedure TForm1.WMMENUSELECT(var message: TWMMENUSELECT);
begin
  inherited;
  IsMenuOpen := not ((message.MenuFlag and $FFFF =  0) and (message.Menu = 0));
end;