加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

图标 – 如何使用Inno Setup创建桌面图标

发布时间:2020-12-15 04:19:13 所属栏目:大数据 来源:网络整理
导读:我是Inno Setup的新手,我希望在Inno Setup中为我的可执行文件添加一个桌面图标.该文件存储在 C:UsersPycharmProjectsGIOTTOconverterdistgiotto.ico 我尝试了几个例子,但没有结果. ; Script generated by the Inno Setup Script Wizard.; SEE THE DOCUM
我是Inno Setup的新手,我希望在Inno Setup中为我的可执行文件添加一个桌面图标.该文件存储在
C:UsersPycharmProjectsGIOTTOconverterdistgiotto.ico

我尝试了几个例子,但没有结果.

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

#define MyAppName "GIOTTO"
#define MyAppVersion "1.0"
#define MyAppExeName "GIOTTO.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={{48A8A469-1711-46FD-AC87-1596EF57C123}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputBaseFilename=GiottoSetup
SetupIconFile=C:UsersPycharmProjectsGIOTTOconverterdistgiotto.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:LanguagesFrench.isl"
Name: "italian"; MessagesFile: "compiler:LanguagesItalian.isl"
Name: "spanish"; MessagesFile: "compiler:LanguagesSpanish.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:UsersPycharmProjectsGIOTTOconverterdistGIOTTO.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:UsersPycharmProjectsGIOTTOconverterdist*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}{#MyAppName}"; Filename: "{app}{#MyAppExeName}"
Name: "{group}{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}{#MyAppName}"; Filename: "{app}{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}MicrosoftInternet ExplorerQuick Launch{#MyAppName}"; Filename: "{app}{#MyAppExeName}"; Tasks: quicklaunchicon

[Run]
Filename: "{app}{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName,'&','&&')}}"; Flags: nowait postinstall skipifsilent

解决方法

[Files] section中,您将giotto.ico安装到应用程序文件夹(您可能只想在选择desktopicon任务时安装图标).

[Icons] section中,您使用已安装的giotto.ico创建桌面图标(选择桌面图标任务时).

#define SourcePath "C:UsersPycharmProjectsGIOTTOconverterdist"
#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

虽然可执行文件(GIOTTO.exe)具有链接的相同图标,但您无需单独安装该图标.只需使用EXE文件中的图标:

#define SourcePath "C:UsersPycharmProjectsGIOTTOconverterdist"
#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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读