在任务页面中添加复选框在创建设置中,并根据复选框使其工作

时间:2015-06-10 09:20:11

标签: checkbox task inno-setup

如何在inno设置的任务页面中添加复选框,并使其按选中或取消选中的方式工作:

  • 安装Visual C ++

我试过了 -

  [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和这里(stackoverflow.com)非常新。有谁能够帮我。提前谢谢。

1 个答案:

答案 0 :(得分:1)

这是我的问题的答案

信用转到 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