1

My Inno app installer requires admin privileges and installs into program files by default with shortcut icons (app and user manual) on the common desktop. At times it's convenient to install the shortcuts onto the user desktop or not at all so I'd like to give 3 options: Public desktop, User desktop or No shortcuts. However I don't know how/where to do the shortcut creation after the selection is made.

[Code]

var
  OptionPage: TInputOptionWizardPage;

procedure InitializeWizard();
begin
  OptionPage :=
    CreateInputOptionPage(
      wpWelcome,
      'Choose shortcuts option', 'Where would you like the application and user manual shortcuts?',
      'Please select an option below.',
      True, False);

  OptionPage.Add('&Public desktop');
  OptionPage.Add('&User desktop only');
  OptionPage.Add('&No shortcuts');

  OptionPage.Values[0] := True;
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  if CurPageID = OptionPage.ID then
  begin
    if OptionPage.Values[0] then
    begin
      { copy shortcuts to public desktop? }
    end;
    if OptionPage.Values[1] then
    begin
      { copy shortcuts to user desktop only? }
    end;
    if OptionPage.Values[2] then
      { do nothing? }
  end;
  Result := True;
end;

Can anyone point me in the right direction?

SealJohn
  • 31
  • 1
  • 5
  • Well, you should not. See [Installing application for currently logged in user from Inno Setup installer running as Administrator](https://stackoverflow.com/q/44575666/850848). – Martin Prikryl Feb 08 '22 at 13:13
  • Agree with @MartinPrikryl. All you really need is a `[Tasks]` entry to give the user a choice and `{autodesktop}` for the icon's path (with a `Tasks` parameter so it is only created if the user chooses). The `{autodesktop}` constant will put the icon file in the correct directory based on the install mode (admin or non-admin). – Bill_Stewart Feb 08 '22 at 19:39
  • Perfect, thank you both. – SealJohn Feb 10 '22 at 00:14

0 Answers0