How can I add a check box for optional files during install in Inno Setup?

后端 未结 4 887
[愿得一人]
[愿得一人] 2020-12-29 14:06

I\'m trying to make a custom checkbox in my custom page (because it\'s a one page installer), is needed only a checkbox without dialogs or anything, the installer that I\'m

4条回答
  •  甜味超标
    2020-12-29 14:56

    You don't have to manually create checkboxes for that. The standard way to let the user choose what to install is to use the [Types] and [Components] sections of your script file.

    Take a look at the Components.iss script located in your Inno Setup install folder\examples.

    ; -- Components.iss --
    ; Demonstrates a components-based installation.
    
    ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!
    
    [Setup]
    AppName=My Program
    AppVersion=1.5
    DefaultDirName={pf}\My Program
    DefaultGroupName=My Program
    UninstallDisplayIcon={app}\MyProg.exe
    OutputDir=userdocs:Inno Setup Examples Output
    
    [Types]
    Name: "full"; Description: "Full installation"
    Name: "compact"; Description: "Compact installation"
    Name: "custom"; Description: "Custom installation"; Flags: iscustom
    
    [Components]
    Name: "program"; Description: "Program Files"; Types: full compact custom; Flags: fixed
    Name: "help"; Description: "Help File"; Types: full
    Name: "readme"; Description: "Readme File"; Types: full
    Name: "readme\en"; Description: "English"; Flags: exclusive
    Name: "readme\de"; Description: "German"; Flags: exclusive
    
    [Files]
    Source: "MyProg.exe"; DestDir: "{app}"; Components: program
    Source: "MyProg.chm"; DestDir: "{app}"; Components: help
    Source: "Readme.txt"; DestDir: "{app}"; Components: readme\en; Flags: isreadme
    Source: "Readme-German.txt"; DestName: "Liesmich.txt"; DestDir: "{app}"; Components: readme\de; Flags: isreadme
    
    [Icons]
    Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
    

    At runtime, the installer presents this dialog within the wizard:

    Components dialog

提交回复
热议问题