views:

1409

answers:

2

I'm trying to create an installer using NSIS Modern User Interface for the first time. I would like to know how I can add an option (checkbox) for users to select to have a desktop shortcut created on the Finish Page (the last screen of the installer) in addition to the "Run XXXX" option that's already there.

+3  A: 

An alternate, and the simplest way to allow the user to add a desktop icon is to create a custom Section that does it. The user can then choose to add the shortcut in the "features" page of the installer and you don't have to do heavy modifications of the UI.

Section "Desktop Shortcut" SectionX
    SetShellVarContext current
    CreateShortCut "$DESKTOP\Your Program.lnk" "$INSTDIR\YourProgram.exe"
SectionEnd
Julien Lebosquain
+2  A: 

If you are not using readme checkbox on the finish page, you can use it to perform whatever action you want:

Function finishpageaction
CreateShortcut "$desktop\foo.lnk" "$instdir\foo.exe"
FunctionEnd

!define MUI_FINISHPAGE_SHOWREADME ""
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
Anders
Thank you! This does exactly what I need!!