Inno Setup: Display desktop shortcut on Finish Page - inno-setup

We are showing restart options on finish page as restart is required after our product installation. If we show restart options on finish page we are unable to display checkbox on finish page. Is there a way to show both restart options and checkbox on finish page.

Not directly. You have to basically implement your own set of checkboxes, and handle them on your own.
I'm doing the same in my installer. See my .iss. The Numbers in the list below point to respective lines in my code.
In InitializeWizard create a set of checkboxes on WizardForm.FinishedPage. #1144
Implement event handler for WizardForm.YesRadio.OnClick and WizardForm.NoRadio.OnClick to disable (enable) the checkboxes when user opts to restart (or not restart). As #TLama pointed out, it does not make sense to execute something, if user is going to restart the machine. #621 #1212
In CurPageChanged for CurPageID = wpFinished, place the checkboxes below WizardForm.FinishedLabel, if restarting is not needed; or below WizardForm.NoRadio.Top, if restarting is needed (if restarting is needed always, you do not need this dynamic placement). #1295
In CurStepChanged for CurPageID = wpDone, process the actions according to checkboxes, if user opted not to restart. #1443

you can do this using NeedRestart() method, as describe in following code. just set flag boolean flag ResultForRestart to true if restart required or make it false as follows
ResultForRestart: Boolean; // globel in code section
function NeedRestart(): Boolean;
begin
Result := ResultForRestart;
end;
set flag ResultForRestart true/false as you requirement it will add two radio button restart now or latter

Related

Can I show the custom window before all the wizard pages in Inno Setup?

I export a function from dll like this:
function IsClientLaunched : Boolean;
external 'IsClientStarted#files:IsStart.dll stdcall setuponly';
I need this function to check if my application is already running or not. It returns True if it's running and false if it's not.
What I need to do is depending on the result of that function I have to show the custom window with the custom message and 2 buttons: Continue and Cancel. So if I close the app and press Continue then the installation process goes on. If I press Cancel then the installer finishes its work and closes. The problem is that I don't know how to show that custom window before all the wizard pages and if it's even possible to do that?
Also, I use ISSI to show the splash screen:
#define ISSI_Splash "C:\InnoSetupProject\Images\client.bmp"
#define ISSI_Splash_T 3
#define ISSI_Splash_X 500
#define ISSI_Splash_Y 220
There's also one problem with that. If I show the MsgBox dialog before the first wizard page and press Cancel on it I want my setup program to close, but instead it shows me the splash screen anyway and then closes. Can I somehow cancel it if I need it in InitializeSetup?
Use the code from:
Is it possible to check if program is already running before trying to install it? (Inno Setup)
(it's your question!)
And just replace IsAppRunning with your IsClientLaunched.
Though, now the question is, whether you need your custom IsClientLaunched at all. You can use the IsAppRunning instead.
According to the CreateCustomPage documentation the parameters for creating a custom page are as follows:
function CreateCustomPage(const AfterID: Integer;
const ACaption,
ADescription: String): TWizardPage;
As you can see, you are providing AfterID which implies you can tell it to show a custom page after a specific builtin page.
But, have you considered using PrepareToInstall? It says:
You can use this event function to detect and install missing
prerequisites and/or to shutdown any application which is about to be
updated.
So maybe you can do your tests there and show any needed pop-up message box. Then, based on the reply, you can return with the appropriate error message. The documentation explains.
There might be other ways to do what you want.

Inno Setup Disable Next Button if user does not replace 'Enter' with anything else [duplicate]

This question already has answers here:
Inno Setup Disable Next button when input is not valid
(1 answer)
How to disable NextButton when file is not selected on InputFilePage (CreateInputFilePage)?
(1 answer)
Closed 4 years ago.
How do I prevent user from moving on if 'Enter' is not overwritten with anything else. Instead of 'Enter', I can also just make it blank. Regardless, the user must put something in there in order to enable the Next button. This is the second window after the welcome page that I need to do this with.
[Code]
var
SettingEnv: TInputQueryWizardPage;
procedure InitializeWizard;
begin
SettingEnv := CreateInputQueryPage(wpWelcome,
'User Input', '', 'Enter SettingEnv, then click Next.');
SettingEnv.Add('', False);
SettingEnv.Values[0] := 'Enter';
end;
I suggest you use:
function NextButtonClick(CurPageID: Integer): Boolean;
From the documentation:
Called when the user clicks the Next button. If you return True,
the wizard will move to the next page; if you return False, it will
remain on the current page (specified by CurPageID).
Note that this function is called on silent installs as well, even
though there is no Next button that the user can click. Setup instead
simulates "clicks" on the Next button. On a silent install, if your
NextButtonClick function returns False prior to installation starting,
Setup will exit automatically.
There is a related answer to a similar question which has code. This will help.

Changing label texts on WizardForm page in Inno Setup

I want to change (in code) the text of certain labels on the WizardForm of the installer which are NOT exposed by the WizardForm.
Example:
ReadyLabel2a=Click Install to continue with the installation, or click Back if you want to review or change any settings.
I cannot do WizardForm.ReadyLabel2a.Caption := 'BLAH'; as the compiler complains about unknown identifier ReadyLabel2a.
Is there a way to do it?
Thanks
All components of the installer wizard form are exposed.
The label is ReadyLabel, not ReadyLabel2a. The ReadyLabel2a is ID of the message. The installer uses either message ReadyLabel2a or ReadyLabel2b for the ReadyLabel, depending on the setup configuration.
WizardForm.ReadyLabel.Caption := 'BLAH';
See TWizardForm class declaration.
You can find how the messages are used in controls in Inno Setup source code
If you need to have an installer specific texts for certain standard messages, modify the texts using Messages section:
[Messages]
ReadyLabel2a=Click Install to continue with the installation, or click Back if you want to review or change any settings.

Show the download progress by default and no hide button

When starting to download files from my setup, it only appears total progress and the button details to show what appears in the next image:
What I want to do is to have that step by default without hitting details button and not showing the hide button.
I assume, that we are talking about this Inno Download Plugin. On its source code page I found the idp.iss script file which seems to be an interface to the library. It contains the idpShowDetails function which if you call with the show parameter set to True will show the detail components, that you can see by clicking the details button. What remains then is hiding that details button, which in the script is accessible through the IDPForm record variable's DetailsButton member. Through this member you can set the Visible property to False to hide that button.
To realize this without modifying the original scripts you can include the following piece of code into your existing script:
procedure CurPageChanged(CurPageID: Integer);
begin
// if the downloader page was just shown, then...
if CurPageID = IDPForm.Page.ID then
begin
// show the detail components
idpShowDetails(True);
// and hide the details button
IDPForm.DetailsButton.Visible := False;
end;
end;
And a screenshot:

How execute code before which the Inno Select language dialog is shown

I need to execute a pascal code before that the Select Setup language Dialog is shown , unfortunately the InitializeSetup event is executed after.
function InitializeSetup(): Boolean; //This event occurs to late
begin
DoSomething();
Result := True;
end;
So it's possible execute a script code before of the Select Setup language Dialog is shown?
I had similar problem, and I thought about different workarounds: style all setup manually, or make inner localization, but they all looked so doomed from the beginning.
Select Setup language Dialog
I have forked issrc, built it locally, and looked at the main.pas of the Setup project. I see the idea behind doing as it is now : people may wanna use {Language} in InitializeSetup, so its called after the AskForLanguage method.
To just check the idea I made small changes to main.pas: call AskForLanguage after CodeRunner inited and InitializeSetup called. I got VCL'ed Select Setup Language dialog, but not all - NON Client Area wasnt VCL'ed:
I've tried to inherit the language form not from the TForm class but from the TSetupForm, or call it in the middle of setup or make other changes - with no result. If anybody know why it's not VCL'ed - tell me please!
Then I read the Custom Window Frame Using DWM article and just made the form border bsNone and got this:
So for now I'm fine with it. That form not styled before many pages of styled setup was so... annoying.
If we wanna do it a right way, I guess all that needs to be done - is moving CodeRunner init before AskForLanguage, and add a custom code function like StyleInit or so. Then all will be happy: {Language} will be available in InitializeSetup and Dialog will be VCL'ed.
No, the function InitializeSetup() is called as first.
All other functions are called later.
Of course you can modify Inno's sources and add custom functions but I think it is not your case.
Why do you need this? Maybe there is solution which can solve your situation, please tell us details.
Another possible solution is using Inno setup Ultra, it has several inprovements, and InitializeLanguageDialog function is one of them. just load style in it. (Also you can freely change language dialog itself that is so nice).

Resources