Changing label texts on WizardForm page in Inno Setup - 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.

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.

Leave Inno Setup DefaultDirName empty or with message "choose install directory"

I made a plugin for 3ds Max and I need two things:
A message "Choose your 3ds Max root" in the path field in place of "c:... or d:...".
I also need that the Next button can't be clicked, if the user didn't choose the path manually with the Browse button.
Thanks much.
Autodesk 3ds Max stores its installation directory in the Windows Registry. You can set your Inno Setup installer to check that registry entry and use it as a default.
Here's a link to the 3ds Max SDK Programmer's Guide: 3ds Max Install Directory Registry Key.
Clear the DirEdit in InitializeWizard event function. You probably want to clear it on first install only, not on re-install/upgrade. Inno Setup itself will not allow user to proceed, unless user selects the path.
You can change the messages on the "Select Destination Location" in the [Messages] section. Change entries like WizardSelectDir, SelectDirDesc, SelectDirLabel3 and SelectDirBrowseLabel.
[Messages]
WizardSelectDir=Choose install directory
[Code]
procedure InitializeWizard();
begin
if not IsUpgrade then
begin
WizardForm.DirEdit.Text := '';
end;
end;
For IsUpgrade function, see for example Inno Setup: How to overwrite on install but not on change?
Or you can create a completely new custom page:
How to ask the user to specify a folder name (using Inno Setup)?
(and hide the standard one?)

Inno Setup: WizardForm from an external form

I was trying to create an installer for my new project and used an external DLL to call a function to create a custom form. Instead of using the WizardForm, can I create the WizardForm from that custom form?
Here's the code I use to create that form:
procedure NewFormCreate;
var
rt: TTimer;
begin
NewForm:= TForm.Create(nil);
NewForm.BorderStyle := bsNone;
CreateFormFromImage(NewForm.Handle, 'form.png');
rt:= TTimer.create(nil);
rt.OnTimer:= #WFProc;
rt.Interval:= 1;
rt.Enabled:= true;
NewForm.Show;
NewForm.Enabled:= False;
end;
If I understand your question correctly, you want to use your own implementation of the WizardForm.
You cannot. You can only modify the existing WizardForm. Maybe like this:
CreateFormFromImage(WizardForm.Handle, 'form.png');
You can of course create and display your own form, and prevent the WizardForm from even displaying.
But it does not make sense. The Inno Setup is all about the WizardForm. If you do not want to use it, you do not need the Inno Setup at all. Build your custom installer in Delphi (if that's your preferred IDE).
Maybe you should explain us what do you really want to achieve. It's quite probable that you have an XY problem.
Is your X problem creating an installer with irregular shape?
Instead of scripting everything manually you can use Graphical Installer for Inno Setup (http://graphical-installer.com/) and achieve something like this in few minutes:
If you use Delphi you can use RAD & Installer (http://rad-installer.com/) to create the Inno Setup installers directly from RAD Studio IDE.
Sorry for little self promo :)

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).

How to modify setup page?

I want to add some information on wpSelectComponents page about components/types of the installation.
Is there a possibility to add some text / description to for example wpSelectComponents page?
If you just want static text, you can set custom text using the [Messages] section (See Inno's Default.isl for the current values and names).
If you want to show more descriptive text when selecting a component, you will need to do it in [Code] by creating your own labels on the page and setting the text as appropriate.

Resources