Delphi   发布时间:2022-04-11  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了图标 – 如何使用Inno Setup创建桌面图标大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我是Inno Setup的新手,我希望在Inno Setup中为我的可执行文件添加一个桌面图标.该文件存储在
C:\Users\PycharmProjects\GIOTTOconverter\dist\giotto.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:\Users\PycharmProjects\GIOTTOconverter\dist\giotto.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; messagesFile: "compiler:Default.isl"
Name: "french"; messagesFile: "compiler:Languages\French.isl"
Name: "italian"; messagesFile: "compiler:Languages\Italian.isl"
Name: "spanish"; messagesFile: "compiler:Languages\Spanish.isl"

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

[Files]
source: "C:\Users\PycharmProjects\GIOTTOconverter\dist\GIOTTO.exe"; DestDir: "{app}"; Flags: ignoreversion
source: "C:\Users\PycharmProjects\GIOTTOconverter\dist\*"; 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}\{CR_423_11845@:UninstallProgram,{#MyAppNamE}}"; Filename: "{uninstallexE}"
Name: "{Commondesktop}\{#MyAppNamE}"; Filename: "{app}\{#MyAppExename}"; Tasks: desktopicon
Name: "{userapPDAta}\Microsoft\Internet Explorer\Quick Launch\{#MyAppNamE}"; Filename: "{app}\{#MyAppExename}"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\{#MyAppExename}"; Description: "{CR_423_11845@:LaunchProgram,{#StringChange(MyAppName,'&','&&')}}"; Flags: nowait posTinstall skipifsilent

解决方法

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

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

#define sourcePath "C:\Users\PycharmProjects\GIOTTOconverter\dist"
#define MyAppName "GIOTTO"
#define MyAppExename "GIOTTO.exe"
#define MyAppIcoName "giotto.ico"

[Tasks]
Name: "desktopicon"; Description: "{CR_423_11845@:CreateDesktopIcon}"; \
    GroupDescription: "{CR_423_11845@: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:\Users\PycharmProjects\GIOTTOconverter\dist"
#define MyAppName "GIOTTO"
#define MyAppExename "GIOTTO.exe"

[Tasks]
Name: "desktopicon"; Description: "{CR_423_11845@:CreateDesktopIcon}"; \
    GroupDescription: "{CR_423_11845@:AdditionalIcons}"; Flags: unchecked

[Files]
source: "{#sourcePath}\{#MyAppExename}"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{userdesktop}\{#MyAppNamE}"; Filename: "{app}\{#MyAppExename}"; Tasks: desktopicon

大佬总结

以上是大佬教程为你收集整理的图标 – 如何使用Inno Setup创建桌面图标全部内容,希望文章能够帮你解决图标 – 如何使用Inno Setup创建桌面图标所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。