How to create a desktop icon with Inno Setup

前端 未结 1 653
太阳男子
太阳男子 2020-12-16 16:26

I am very new of Inno Setup and I wish to add a Desktop icon to my executable in Inno Setup. The file is stored in

C:\\Users\\PycharmProjects\\GIOTTOconvert         


        
相关标签:
1条回答
  • 2020-12-16 16:47

    In [Files] section, you install your giotto.ico to the application folder (you may want to install the icon only when the desktopicon task is selected).

    In [Icons] section, you create the desktop icon using the installed giotto.ico (when the desktopicon task is selected).

    #define SourcePath "C:\Users\PycharmProjects\GIOTTOconverter\dist"
    #define MyAppName "GIOTTO"
    #define MyAppExeName "GIOTTO.exe"
    #define MyAppIcoName "giotto.ico"
    
    [Tasks]
    Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
        GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
    
    [Files]
    Source: "{#SourcePath}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
    Source: "{#SourcePath}\{#MyAppIcoName}"; DestDir: "{app}"
    
    [Icons]
    Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; \
        IconFilename: "{app}\{#MyAppIcoName}"; Tasks: desktopicon
    

    Though if the executable file (GIOTTO.exe) has the same icon linked into, you do not need to install the icon separately. Just use the icon from the EXE file:

    #define SourcePath "C:\Users\PycharmProjects\GIOTTOconverter\dist"
    #define MyAppName "GIOTTO"
    #define MyAppExeName "GIOTTO.exe"
    
    [Tasks]
    Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
        GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
    
    [Files]
    Source: "{#SourcePath}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
    
    [Icons]
    Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
    
    0 讨论(0)
提交回复
热议问题