Fixed elevation prompt (UAC) to run the application at the end of installation.

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

#define MyAppName "MenuTools"
#define MyAppVersion "1.0.0.0"
#define MyAppPublisher "Navossoc Softwares"
#define MyAppURL "http://www.navossoc.com/"
#define MyAppExeName "MenuTools.exe"
#define MyAppWindowClass "MENUTOOLS"

[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={{D8935B4B-F013-4637-A25F-1531B35980A2}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=..\Setup\LICENSE.txt
OutputDir=..\Release
OutputBaseFilename=menutools setup
SetupIconFile=..\Setup\icon\MenuTools.ico
Compression=lzma
SolidCompression=yes
MinVersion=5.1sp3
ArchitecturesInstallIn64BitMode=x64
PrivilegesRequired=admin

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "startupicon"; Description: "{cm:AutoStartProgram,{#MyAppName}}"; GroupDescription: "{cm:AutoStartProgramGroupDescription}"

[Files]
Source: "..\Release\MenuTools.exe"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete;
Source: "..\Release\MenuTools64.exe"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete; Check: Is64BitInstallMode
Source: "..\Release\MenuToolsHook.dll"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete
Source: "..\Release\MenuToolsHook64.dll"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete; Check: Is64BitInstallMode
Source: "..\Setup\icon\*"; DestDir: "{app}\icon"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\Setup\LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion

[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: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: startupicon

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

[Code]
function InitializeUninstall(): Boolean;
begin
  Result := True;
  while (FindWindowByClassName('{#MyAppWindowClass}') <> 0) AND Result do
  begin
    if MsgBox(FmtMessage(SetupMessage(msgUninstallAppRunningError), ['{#MyAppName}']), mbError, MB_OKCANCEL) = IDCANCEL then
    begin
        Result := False;
    end;
  end;
end;

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

#define MyAppName "MenuTools"
#define MyAppVersion "1.0.0.0"
#define MyAppPublisher "Navossoc Softwares"
#define MyAppURL "http://www.navossoc.com/"
#define MyAppExeName "MenuTools.exe"
#define MyAppWindowClass "MENUTOOLS"

[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={{D8935B4B-F013-4637-A25F-1531B35980A2}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=..\Setup\LICENSE.txt
OutputDir=..\Release
OutputBaseFilename=menutools setup
SetupIconFile=..\Setup\icon\MenuTools.ico
Compression=lzma
SolidCompression=yes
MinVersion=5.1sp3
ArchitecturesInstallIn64BitMode=x64
PrivilegesRequired=admin

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "startupicon"; Description: "{cm:AutoStartProgram,{#MyAppName}}"; GroupDescription: "{cm:AutoStartProgramGroupDescription}"

[Files]
Source: "..\Release\MenuTools.exe"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete;
Source: "..\Release\MenuTools64.exe"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete; Check: Is64BitInstallMode
Source: "..\Release\MenuToolsHook.dll"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete
Source: "..\Release\MenuToolsHook64.dll"; DestDir: "{app}"; Flags: ignoreversion uninsrestartdelete; Check: Is64BitInstallMode
Source: "..\Setup\icon\*"; DestDir: "{app}\icon"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\Setup\LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion

; SetupAppRunningError
; UninstallAppRunningError

[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: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: startupicon

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

[Code]
function InitializeUninstall(): Boolean;
begin
  Result := True;
  while (FindWindowByClassName('{#MyAppWindowClass}') <> 0) AND Result do
  begin
    if MsgBox(FmtMessage(SetupMessage(msgUninstallAppRunningError), ['{#MyAppName}']), mbError, MB_OKCANCEL) = IDCANCEL then
    begin
        Result := False;
    end;
  end;
end;