Remove destination folder icon - inno-setup

How can I remove the folder icon that appears on the installation page?

Hide the respective component – WizardForm.SelectDirBitmapImage:
[Code]
procedure InitializeWizard();
begin
WizardForm.SelectDirBitmapImage.Visible := False;
end;

Related

How to stretch small wizard image over whole area in Inno Setup?

I need to stretch small wizard image in Inno Setup over the whole bitmap area and hide the labels like "select installation folder"... etc. What would be the corresponding code for this?
Set bounds of the WizardSmallBitmapImage to that of its parent
Hide the labels (PageDescriptionLabel and PageNameLabel)
procedure InitializeWizard();
begin
with WizardForm.WizardSmallBitmapImage do
SetBounds(Parent.Left, Parent.Top, Parent.Width, Parent.Height);
WizardForm.PageDescriptionLabel.Visible := False;
WizardForm.PageNameLabel.Visible := False;
end;

How to hide the label at the bottom of the page in select directory page in inno setup

I want to remove the label at the bottom of the page where i select the directory to install the components. The label shows minimum disk space required to install applications.
You want to hide the DiskSpaceLabel control:
[Code]
procedure InitializeWizard;
begin
WizardForm.DiskSpaceLabel.Visible := False;
end;
That will hide the label marked on this screenshot:

cancel button not displayed for wizard page created with wpInfoAfter in inno setup

I have created a custom wizard page in inno, which needs to be shown after installing the files to {app} folder. This is achieved by giving the wpInfoAfter.
The problem is, its showing only the 'next' button, there is no cancel/back button, also the dialog's closing button on top right is also disabled. I understand that the back button isn't needed, as it needs to remove the files which are installed. Is there anyway the 'cancel' button can be displayed?
The Cancel button has no functionality at the after install stage, because InnoSetup doesn't expect to do further actions, that would require cancel, after the installation process is done. So, even if you show the button against that fact, you would get a button without any action.
Personally I would prefer to collect the information needed to setup your database before the installation starts, because consider the situation when the user installs your application and simply cancel the after installation wizard (what can easily happen). Doing it before, you'll be able to force your users to fill what you need before they actually get to the application itself. But if you still want to do it after install, here is a workaround for that missing cancel button.
As a workaround, you can create your own custom button, that will be on a same position with the same functionality. Here is a sample script, simulating a cancel button and showing it only on the custom page which is laying after the installation process. It's just a workaround, because you'd need at least fix this:
enable the closing cross of the wizard form (it's disabled after the installation stage is done)
handle the ESC key shortcut somehow (it invokes the exit prompt dialog too, but I couldn't find a way how to workaround this)
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Code]
procedure ExitProcess(uExitCode: UINT);
external 'ExitProcess#kernel32.dll stdcall';
var
CustomPage: TWizardPage;
CancelButton: TNewButton;
procedure OnCancelButtonClick(Sender: TObject);
begin
// confirmation "Exit setup ?" message, if user accept, then...
if ExitSetupMsgBox then
begin
// stop and rollback actions you did from your after install
// process and kill the setup process itself
ExitProcess(0);
end;
end;
procedure InitializeWizard;
begin
// create a custom page
CustomPage := CreateCustomPage(wpInfoAfter, 'Caption', 'Description');
// create a cancel button, set its parent, hide it, setup the bounds
// and caption by the original and assign the click event
CancelButton := TNewButton.Create(WizardForm);
CancelButton.Parent := WizardForm;
CancelButton.Visible := False;
CancelButton.SetBounds(
WizardForm.CancelButton.Left,
WizardForm.CancelButton.Top,
WizardForm.CancelButton.Width,
WizardForm.CancelButton.Height
);
CancelButton.Caption := SetupMessage(msgButtonCancel);
CancelButton.OnClick := #OnCancelButtonClick;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
// show your fake Cancel button only when you're on some of your after
// install pages; if you have more pages use something like this
// CancelButton.Visible := (CurPageID >= FirstPage.ID) and
// (CurPageID <= LastPage.ID);
// if you have just one page, use the following instead
CancelButton.Visible := CurPageID = CustomPage.ID;
end;

Is it appropriate to create controls in the CurPageChanged procedure?

I have code in CurPageChanged that adds a button to the license window. My CurPageChanged starts like this:
procedure CurPageChanged(CurPageID: Integer);
var Button123 TButton;
begin
if CurPageID = wpLicense then begin
Button123 := TButton.Create(WizardForm.LicenseMemo.Parent);
My question is wouldn't that create a button each time the page is changed to the wpLicense page? So if a user clicks past the license dialog, then goes back to it, wouldn't that create another button? How can I ensure that only one button is created? What I'm looking for is the most appropriate procedure from which to add a control --once-- to an existing wp. Thanks
My question is wouldn't that create a button each time the page is changed to the wpLicense page? So if a user clicks past the license dialog, then goes back to it, wouldn't that create another button?
Yes, it would create multiple buttons each time. Because the pages do not get destroyed, the controls on them do not get destroyed. But you can actually take advantage of that fact to create a single control and then show/hide it when necessary.
To start, modify the InitializeWizard method, which is called only once before the wizard is displayed. Create the button in here, like so:
procedure InitializeWizard();
var
MyButton: TButton;
begin
MyButton := TButton.Create(WizardForm.LicenseMemo.Parent);
MyButton.Parent := WizardForm.LicenseMemo.Parent;
MyButton.Top := 0;
MyButton.Left := 0;
MyButton.Caption := 'My Custom Button';
...
end;

Show License Agreement link in Inno Setup while installation

I am using Inno Setup for my application. I want to show a link (License Agreement) in Inno Setup while installation (except separate License Agreement Wizard). I want combine this link with some task. When user clicks that link it will navigate to particular URL.
I know I'm quite late here... The following code script creates the License Agreement link label in the bottom left part of the wizard form. That label has a blue underlined font and a hand cursor on hover so it looks and feels like a common web page link. On its click event a specified URL is opened in a default web browser. This label is then visible on all wizard pages except the license page one:
[Code]
var
LicenseLinkLabel: TLabel;
procedure LicenseLinkClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ShellExec('', 'http://www.stackoverflow.com', '', '', SW_SHOW, ewNoWait,
ErrorCode);
end;
procedure InitializeWizard;
begin
LicenseLinkLabel := TLabel.Create(WizardForm);
LicenseLinkLabel.Parent := WizardForm;
LicenseLinkLabel.Left := 8;
LicenseLinkLabel.Top := WizardForm.ClientHeight -
LicenseLinkLabel.ClientHeight - 8;
LicenseLinkLabel.Cursor := crHand;
LicenseLinkLabel.Font.Color := clBlue;
LicenseLinkLabel.Font.Style := [fsUnderline];
LicenseLinkLabel.Caption := 'License Agreement';
LicenseLinkLabel.OnClick := #LicenseLinkClick;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
LicenseLinkLabel.Visible := CurPageID <> wpLicense;
end;
And the result (click to enlarge):
Create an RTF formatted license text (with Wordpad for very small file size) and type the hyperlink in the text as pure text, no extra functions needed (eg. 'http://stackoverflow.com'). InnoSetup will display this URL and make it clickable. Be aware that e-mail links do not work properly.
Wanna try? Save this entire text Wordpad, save as RTF and link it to InnoSetup.
Dutch

Resources