如何在 Inno Setup 中为按钮添加访问键

How to add access key to button in Inno Setup

我想为我的音频按钮添加 Alt 功能; Alt+M 静音Alt+P 播放 像这样

怎么样?应该输入什么代码?我将在哪里插入代码?这是我的脚本:

SoundCtrlButton := TNewButton.Create(WizardForm);
SoundCtrlButton.Parent := WizardForm;
SoundCtrlButton.Left := 8;
SoundCtrlButton.Top := WizardForm.ClientHeight - 
  SoundCtrlButton.Height - 8;
SoundCtrlButton.Width := 40;
SoundCtrlButton.Caption :=
  ExpandConstant('{cm:SoundCtrlButtonCaptionSoundOff}');
SoundCtrlButton.OnClick := @SoundCtrlButtonClick;

在 Windows 控件中,您只需在控件标题中的字母前加上 & 以标记为访问键。

https://docs.microsoft.com/en-us/cpp/windows/defining-mnemonics-access-keys#mnemonics-access-keys

SoundCtrlButton.Caption := '&Mute';

或者在您的情况下,间接通过自定义消息:

[CustomMessages]
SoundCtrlButtonCaptionSoundOff=&Mute


查看 Default.isl 中标准按钮标题的定义方式:

ButtonBack=< &Back
ButtonNext=&Next >
ButtonInstall=&Install