InnoSetup - 桌面快捷方式图标损坏

4

开始菜单和所有程序目录中的快捷方式都可以,但桌面上的快捷方式完全是空白/损坏的?

#define MyAppName "MyAppName "
#define MyAppVersion "1"
#define MyAppPublisher "MyAppName"
#define MyAppURL "http://www.MyAppName.com/"
#define MyAppExeName "MyAppName.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=***
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=C:\***\{#MyAppVersion}
OutputBaseFilename=myapp_{#MyAppVersion}
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.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:\***.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\***\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "***\bin\vcredist_x86.exe"; DestDir: {app}\bin\;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" 
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" 
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{group}\Manual"; Filename: "{app}\Manual.pdf"


[Run]
Filename: {app}\bin\vcredist_x86.exe; Parameters: "/q:a /c:""VCREDI~3.EXE /q:a /c:""""msiexec /i vcredist.msi /qn"""" """; WorkingDir: {app}\bin; StatusMsg: Installing Visual Studio 2010 C++ CRT Libraries...
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Code]
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
  sUnInstPath: String;
  sUnInstallString: String;
begin
  sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
  sUnInstallString := '';
  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
  Result := sUnInstallString;
end;


/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
  Result := (GetUninstallString() <> '');
end;


/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
  sUnInstallString: String;
  iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString

  // default return value
  Result := 0;

  // get the uninstall string of the old app
  sUnInstallString := GetUninstallString();
  if sUnInstallString <> '' then begin
    sUnInstallString := RemoveQuotes(sUnInstallString);
    if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
      Result := 3
    else
      Result := 2;
  end else
    Result := 1;
end;

/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if (CurStep=ssInstall) then
  begin
    if (IsUpgrade()) then
    begin
      UnInstallOldVersion();
    end;
  end;
end;

我真的很想知道为什么这个问题被踩了,也许做出这个决定的观众可以给我一些启示。 - Marko29
也许他正在寻找更多细节,比如创建损坏的快捷方式的脚本代码。询问这个问题是获取答案的更好方式,而不仅仅是投票反对。 - Brad Stowers
这确实更有生产力,感谢Brad Stowers的建议。 - Marko29
你的脚本十分标准。lnk文件本身里面有什么?/log有显示任何信息吗? - Deanna
1
无论操作系统版本如何,您在尝试的每台机器上是否都会发生这种情况?如果您右键单击“损坏”的桌面快捷方式并打开其属性对话框,它是否正确?也就是说,目标是否正确指向您的EXE,您是否可以使用“更改图标”按钮设置图标等?正如Deanna建议的那样,使用/log安装它,看看是否有任何奇怪的东西出现。此外,也许尝试将{commondesktop}替换为{userdesktop},看看是否有任何变化。 - Brad Stowers
显示剩余3条评论
1个回答

0

看起来问题出在图标上,只有16x16和32x32的图标可以正常显示在桌面上,使用的是Win7系统。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接