Disable a MenuItem without greying it

Spread the love

Disable a MenuItem without greying it

procedure TForm1.Button1Click(Sender: TObject);
var
   M: TMenu;
begin
     M := Application.MainForm.Menu;
     // The first Item will be disabled
     EnableMenuItem(M.Handle, M.Items[0].Command, MF_BYCOMMAND or MF_DISABLED);
end;