在 inno-setup 的任务页面中添加复选框并使其根据复选框工作

Add checkbox in task Page In inno-setup and make it work according to checkbox

如何在 inno setup 的任务页面中添加复选框并使其以选中或未选中的方式工作:

我试过了-

  [Tasks] 
 Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons} 
 Name: vcredist_x64; Description: Install Visual C++; Flags: unchecked   
  [Code] 
 procedure CurStepChanged(CurStep: TSetupStep); 
 begin 
   if CurStep = ssPostInstall then 
   begin 
   var 
   ResultCode: Integer;
 begin
     if IsTaskSelected('vcredist_x64') then 
   begin 
       Status.Caption:='Installing Visual C++...';    
       Exec(ExpandConstant('{src}\Redist\vcredist_x64.exe'),'/q',false)

但是它显示了一些错误Identifier expected

我对 inno-setup 和这里 (whosebug.com) 很陌生。有谁能够帮助我。提前致谢。

这是我的问题的答案

归功于 TLama

Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{49AA44CB-55C1-47D3-9B89-84D4A1271A8D}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=Setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon};GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
Name: vcredist_x64; Description: Install Visual C++; Flags: unchecked

[Files]
Source: C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe; DestDir: {app}; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName};Tasks: desktopicon

[Run]
Filename: {src}\redist\vcredist_x64.exe; Parameters: /q; StatusMsg: Installing Visual C++...; Tasks: vcredist_x64