Change default option for restart (if it is needed) - inno-setup

In Inno Setup based installer, is there a way to change the default selection for the restart option shown on the Finish page if restart is needed ? Please note that I am not asking about how to make the installer never ask for a reboot.
Currently, the restart option shows up with "Yes, restart the computer now" as the default selection and some users of the installer have raised a concern that if they are in a haste, they end up clicking on "Finish" button, thus causing the restart to happen.
I see a similar question here.
Similarly, the restart message box shown on uninstalling comes up with default set to "Yes" button. Is there a way to change that too?

Just select the NoRadio instead of the default YesRadio:
procedure InitializeWizard();
begin
WizardForm.NoRadio.Checked := True;
end;
You cannot change, what button is focused by default on the restart prompt in uninstaller.

Related

Bring Inno Setup installer to the foreground

How to bring the installer to the foreground at every progress page? (Assuming that the person installing the program decides to do other things with the computer in the meantime).
I am using this code to install DirectX and redist:
Inno Setup - Avoid displaying filenames of sub-installers
(look only the part that includes this ProgressPage := CreateOutputProgressPage).
Do not even try this. That ruins user experience.
And Windows actually prevents you from doing that anyway.
If you need to bring user attention to your installer/application, flash its taskbar button.

Change Inno Setup messages from Pascal code

I need to change ConfirmUninstall, UninstalledMost (just in case), and UninstalledAll specifically from script to set a condition. Something like this:
if FileExists(ExpandConstant('{app}\Slash.exe')) then
SetupMessage(msgConfirmUninstall) := FmtMessage(SetupMessage(msgConfirmUninstall), ['Dagon Slasher'])
else if FileExists(ExpandConstant('{app}\Frank.exe')) then
SetupMessage(msgConfirmUninstall) := FmtMessage(SetupMessage(msgConfirmUninstall), ['Dagon Frankenstein'])
else
SetupMessage(msgConfirmUninstall) := FmtMessage(SetupMessage(msgConfirmUninstall), ['Dagon Video Tools']);
But this doesn't work. These messages are used in MsgBoxes, so I can't think of any other way. Running in silent mode is not really suitable for me, since setup will run uninstall if the programs (or one of them) has already been installed, so I don't want the user to accidentally uninstall the program by running the setup.
You cannot change these easily, see:
Replace or customize modal uninstallation windows in Inno Setup
Regarding the silent uninstall solution: I do not understand your problem with "setup will run uninstall if the programs (or one of them) has already been installed".
I assume you run the uninstaller only after the user confirms (s)he wants to install the new version, so you actually want to run the uninstaller silently, right?
And anyway, there's nothing that prevents you from running the uninstaller non-silently from your installer, even if the entry in "Add/Remove programs" refers to "silent" installation.
You can use generic messages that covers all setup types:
[Messages]
ConfirmUninstall=Are you sure you want to completely remove this game?
As your uninstall messages depend on a type of the installed application, you can modify the installer to:
Create custom "type" page (like a menu) as the very first one.
Once the user selects the "type", restart the installer with a custom switch (e.g. /APPTYPE=slasher) and exit.
Once the installer is (re-)run with the /APPTYPE, you know from the beginning, what component/type you are installing and hence you can set the AppName accordingly (using a scripted constant).
Of course, you skip the custom "type" page.
This is actually not difficult to implement. The only drawback is that the setup window is "recreated" after the user selects the "type".
I've sketched this solution already in my answer to Inno Setup Change AppName based on component(s) selected.

How to disable "browse" button on defaultDirectory wizard page

I want to show the user to wich directory the program will be installed. But I do not want to allow him to change that directory. So I thought about disabling the "browse" button and greying the field where you can type a path (disabling anyone from typing in there).
I have read this question, which is about preventing the user to select a wrong directory. In a comment by TLama I saw this:
Wouldn't be the Next button is greyed until the user chooses the right folder quite misleading ? What if I as the user forget the right directory ? Wouldn't be better to disable the choose folder edit box or skip that page at all ?
But the User asking the Question did not want to do it the suggested way so there is no further hint for this solution. Could you please tell me how to do this?
(Note: Sorry for opening a new question on such a similar topic, but as a new user I can't see another way of asking for help)
You can disable the directory edit box with the browse button this way:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Code]
procedure InitializeWizard;
begin
WizardForm.DirEdit.Enabled := False;
WizardForm.DirBrowseButton.Enabled := False;
end;

how to show EULA during upgrade using installshield

the EULA window is enabled through the Interview panel in Installshield 2011, and it works fine when installing the program first time. However, it won't show in the dialog sequence when we do the upgrade.
I guess it is a default behaviour in Installshield, is it possible to show it all the time? is it wise to do so?
You can Launch Eula window (License Agreement dialog) or custom dialog anytime you want.
When upgrade, launch Eula Dialog from NextButton on SetupResume Dialog, move another conditions to Next Button Eula Dialog, if using License Agreement dialog you must add another conditions "Not Installed" to old Eula Dialog conditions
Next Button Events For License Agreement Dialog will be like this:
Event: NewDialog,
Argument: LicenseAgreement,
Condition: Not Installed
Event: EndDialog,
Argument: Return,
Condition: OutOfNoRbDiskSpace <> 1 AND Installed
Next Button Events For SetupResume Dialog:
Event: NewDialog,
Argument: LicenseAgreement,
Condition: 1
I ran into this problem rather recently with InstallShield 2014, and was having a hard time getting the EULA to pop up on the automagic upgrade path even when adding it to the Next button of the SetupInitialization dialog.
I did find a way to make it happen though:
Go into the Behavior and Logic group, select Custom Actions and Sequences. Expand Sequences > Installation > User Interface.
You can right-click and Insert objects into here. From the Insert Action dialog, select Dialogs in the first dropdown. Then select the EULA-displaying dialog (LicenseAgreement in my case). That will insert it into the UI portion of the Installation Sequence.
From there, you can drag it to where you need it. I dropped it in right after SetupInitialization, but you can also drag it down to just after the PatchWelcome / InstallWelcome / SetupResume / MaintenanceWelcome UI components.
If you do this, you'll want to go to your InstallWelcome dialog (normal installation) and make sure that you skip the EULA there in order to avoid showing it twice. Setting the target to ReadyToInstall (the next step of the LicenseAgreement in my case) allowed me to do that.
That said, doing this means that the EULA will come up every time the installer runs. Ensure that this is what you really want to do.

Cancelling an InnoSetup installer

Situation
During the installation of our product I detect if our programs are still running (from a previous installation) by using CheckForMutexes. If our programs are still running I pop up a message box (by using MsgBox) that tells the user to close the programs. If the user clicks the ok and they haven't closed our programs, the same message box is displayed. I'd like to display a cancel button in the MsgBox that aborts the installation, which would be desired in the case the user doesn't want to close the running programs.
Question
How can I abort an InnoSetup install programmatically?
Thanks in advance
Take a look at InitializeSetup and Abort in the Inno Setup help. The Abort function will allow the setup to exit.
Call the WizardForm.Close() method.
It will prompt the user if she really wants to cancel the installation.
procedure ExitSetup;
begin
WizardForm.Close;
end;

Resources