How do I WelcomeLabel on Inno Setup does not appear and leave only the text over the image.
This is that i want.
Something like this might do the trick. Since the welcome labels don't support transparency, you need to workaround this by creating your own with a different class (that has a transparency support), inherit the parent, font, text and size and hide the original ones. Here is the script how to do this:
[Code]
procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
ATarget.Left := ASource.Left;
ATarget.Top := ASource.Top;
ATarget.Width := ASource.Width;
ATarget.Height := ASource.Height;
end;
procedure InitializeWizard;
var
TopWelcomeLabel: TLabel;
BottomWelcomeLabel: TLabel;
begin
WizardForm.WizardBitmapImage.Align := alClient;
WizardForm.WizardBitmapImage.Bitmap.LoadFromFile('D:\Image.bmp');
TopWelcomeLabel := TLabel.Create(WizardForm);
TopWelcomeLabel.Parent := WizardForm.WelcomeLabel1.Parent;
TopWelcomeLabel.Font := WizardForm.WelcomeLabel1.Font;
TopWelcomeLabel.Caption := WizardForm.WelcomeLabel1.Caption;
TopWelcomeLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel1, TopWelcomeLabel);
WizardForm.WelcomeLabel1.Visible := False;
BottomWelcomeLabel := TLabel.Create(WizardForm);
BottomWelcomeLabel.Parent := WizardForm.WelcomeLabel2.Parent;
BottomWelcomeLabel.Font := WizardForm.WelcomeLabel2.Font;
BottomWelcomeLabel.Caption := WizardForm.WelcomeLabel2.Caption;
BottomWelcomeLabel.WordWrap := WizardForm.WelcomeLabel2.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel2, BottomWelcomeLabel);
WizardForm.WelcomeLabel2.Visible := False;
end;
And the result:
I'm afraid what you want may not be possible or rather difficult, even if creating a custom page. Have a look at the CreateCustomPage() function and the example scripts included with your Inno Setup installation.
This code can help you. Just change the Welcome page, but you can try with other pages of the installer.
[code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
end;
function GetCustomSetupExitCode(): Integer;
begin
Result := 1;
end;
procedure InitializeWizard();
var
WLabel1, WLabel2,
FLabel1, FLabel2: TLabel;
begin
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.FinishedHeadingLabel.Hide;
WizardForm.FinishedLabel.Hide;
WizardForm.WizardBitmapImage.Width := 500;
WizardForm.WizardBitmapImage.Height := 315;
WLabel1 := TLabel.Create(WizardForm);
WLabel1.Left := ScaleX(176);
WLabel1.Top := ScaleY(16);
WLabel1.Width := ScaleX(301);
WLabel1.Height := ScaleY(54);
WLabel1.AutoSize := False;
WLabel1.WordWrap := True;
WLabel1.Font.Name := 'verdana';
WLabel1.Font.Size := 12;
WLabel1.Font.Style := [fsBold];
WLabel1.Font.Color:= clBlack;
WLabel1.ShowAccelChar := False;
WLabel1.Caption := WizardForm.WelcomeLabel1.Caption;
WLabel1.Transparent := True;
WLabel1.Parent := WizardForm.WelcomePage;
WLabel2 :=TLabel.Create(WizardForm);
WLabel2.Top := ScaleY(76);
WLabel2.Left := ScaleX(176);
WLabel2.Width := ScaleX(301);
WLabel2.Height := ScaleY(234);
WLabel2.AutoSize := False;
WLabel2.WordWrap := True;
WLabel2.Font.Name := 'tahoma';
WLabel2.Font.Color:= clBlack;
WLabel2.ShowAccelChar := False;
WLabel2.Caption := WizardForm.WelcomeLabel2.Caption;
WLabel2.Transparent := True;
WLabel2.Parent := WizardForm.WelcomePage;
WizardForm.WizardBitmapImage2.Width := 500;
WizardForm.WizardBitmapImage2.Height := 315;
FLabel1 := TLabel.Create(WizardForm);
FLabel1.Left := ScaleX(176);
FLabel1.Top := ScaleY(16);
FLabel1.Width := ScaleX(301);
FLabel1.Height := ScaleY(54);
FLabel1.AutoSize := False;
FLabel1.WordWrap := True;
FLabel1.Font.Name := 'verdana';
FLabel1.Font.Size := 12;
FLabel1.Font.Style := [fsBold];
FLabel1.Font.Color:= clBlack;
FLabel1.ShowAccelChar := False;
FLabel1.Caption := WizardForm.FinishedHeadingLabel.Caption;
FLabel1.Transparent := True;
FLabel1.Parent := WizardForm.FinishedPage;
FLabel2 :=TLabel.Create(WizardForm);
FLabel2.Top := ScaleY(76);
FLabel2.Left := ScaleX(176);
FLabel2.Width := ScaleX(301);
FLabel2.Height := ScaleY(53);
FLabel2.AutoSize := False;
FLabel2.WordWrap := True;
FLabel2.Font.Name := 'tahoma';
FLabel2.Font.Color:= clBlack;
FLabel2.ShowAccelChar := False;
FLabel2.Caption := WizardForm.FinishedLabel.Caption;
FLabel2.Transparent := True;
FLabel2.Parent := WizardForm.FinishedPage;
end;
Related
I'm trying to create something like this:
I want the check box to be hidden behind the lock image, and clicking on it will open a form requesting code entry, and if the code is correct the image will be removed and the check box will be available.
Here's what I tried:
[files]
Source: "Lock.bmp"; Flags: dontcopy
{...}
[code]
var
CustomFuncPage: TWizardPage;
CBAdvFunctions: TNewCheckBox;
Locked: TBitmapImage;
procedure OnClickLock(Sender: TObject);
var
PassForm: TSetupForm;
Edit: TNewEdit;
OKButton, CancelButton: TNewButton;
begin
PassForm := CreateCustomForm();
PassForm.ClientWidth := ScaleX(256);
PassForm.ClientHeight := ScaleY(128);
PassForm.Caption := 'Password required';
Edit := TNewEdit.Create(PassForm);
Edit.Top := ScaleY(10);
Edit.Left := ScaleX(10);
Edit.Width := PassForm.ClientWidth - ScaleX(20);
Edit.Height := ScaleY(23);
Edit.Anchors := [akLeft, akTop, akRight];
Edit.Parent := PassForm;
OKButton := TNewButton.Create(PassForm);
OKButton.Parent := PassForm;
OKButton.Caption := 'OK';
OKButton.Left := PassForm.ClientWidth - ScaleX(166);
OKButton.Top := PassForm.ClientHeight - ScaleY(33);
OKButton.Height := ScaleY(23);
OKButton.Anchors := [akRight, akBottom]
OKButton.ModalResult := mrOk;
OKButton.Default := True;
CancelButton := TNewButton.Create(PassForm);
CancelButton.Parent := PassForm;
CancelButton.Caption := 'Cancel';
CancelButton.Left := PassForm.ClientWidth - ScaleX(85);
CancelButton.Top := PassForm.ClientHeight - ScaleY(33);
CancelButton.Height := ScaleY(23);
CancelButton.Anchors := [akRight, akBottom]
CancelButton.ModalResult := mrCancel;
CancelButton.Cancel := True;
PassForm.ActiveControl := Edit;
if PassForm.ShowModal() = mrOk then
begin
if Edit.Text = '1234' then
begin
Locked.Free;
PassForm.Free;
end else
begin
MsgBox('Password incorrect', mbError, MB_OK);
PassForm.Free;
end;
end else
begin
PassForm.Free;
end;
end;
Procedure InitializeWizard;
begin
CustomFuncPage := CreateCustomPage(wpSelectProgramGroup, {...}, {...});
CBAdvFunctions := TNewCheckBox.Create(CustomFuncPage);
CBAdvFunctions.Parent := CustomFuncPage.Surface;
CBAdvFunctions.Top := 0;
CBAdvFunctions.Left := 0;
CBAdvFunctions.Caption := 'Advanced Functions'
CBAdvFunctions.Width := ScaleX(130);
CBAdvFunctions.Cursor := 1;
CBAdvFunctions.SendToBack;
ExtractTemporaryFile('Lock.bmp');
Locked := TBitmapImage.Create(CustomFuncPage);
Locked.Parent := CustomFuncPage.Surface;
Locked.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Lock.bmp'));
Locked.Bitmap.AlphaFormat := afPremultiplied;
Locked.SetBounds(0, 0, CBAdvFunctions.Width, CBAdvFunctions.Height);
Locked.Stretch := True;
Locked.BringToFront;
Locked.OnClick := #OnClickLock;
{...}
And this is the result:
This is the image I used:
I tried a few ways, but was unable to get the image to cover the checkbox.
Maybe someone has an idea?
By the way, maybe someone has an explanation for why the background of the image is not transparent?
Does anyone know of a sample or can provide a sample of how to use the Restart Manager built-in to Windows to close explorer.exe at the beginning of the uninstall process of Inno Setup then restarting it just after files removed ? I have some shell items that even after unregistered is still allocated and can't be removed until explorer.exe is closed.
TIA!!
Here's an example of how to do it:
{ Example how to use RestartManager and Offer Option to Delete App Data during Uninstall of Inno Setup }
{ Combined multiple open source ISS code found with some custom changes }
{ This could probably be cleaned up a bit, my goal was to get something to work. }
{ I also stripped it down a bit as I had multiple applications and data so hope }
{ everything removed without an issue, but I'm sure you can figure it out if so }
{-------------------------------------------------------------------------}
{ Copies a NULL-terminated array of characters to a string. }
function ArrayToString(Chars:array of Char):String;
var
Len,i:Longint;
begin
Len:=GetArrayLength(Chars);
SetLength(Result,Len);
i:=0;
while (i<Len) and (Chars[i]<>#0) do begin
Result[i+1]:=Chars[i];
i:=i+1;
end;
SetLength(Result,i);
end;
{-------------------------------------------------------------------------}
type
LONG = Longint;
ULONG = Cardinal;
IdList=array of DWORD;
ProcessEntry=record
ID:DWORD;
Name:String;
Restartable,ToTerminate:Boolean;
end;
ProcessList=array of ProcessEntry;
{
Code for Windows Vista and above
}
const
{ Return codes. }
ERROR_SUCCESS = 0;
ERROR_MORE_DATA = 234;
INVALID_HANDLE_VALUE = -1;
CCH_RM_SESSION_KEY = 32;
CCH_RM_MAX_APP_NAME = 255;
CCH_RM_MAX_SVC_NAME = 63;
RmUnknownApp = 0; { The application cannot be classified as any other type. An application of this type can only be shut down by a forced shutdown. }
RmMainWindow = 1; { A Windows application run as a stand-alone process that displays a top-level window. }
RmOtherWindow = 2; { A Windows application that does not run as a stand-alone process and does not display a top-level window. }
RmService = 3; { The application is a Windows service. }
RmExplorer = 4; { The application is Windows Explorer. }
RmConsole = 5; { The application is a stand-alone console application. }
RmCritical = 1000; { A system restart is required to complete the installation because a process cannot be shut down. }
RmStatusUnknown = $0000;
RmStatusRunning = $0001;
RmStatusStopped = $0002;
RmStatusStoppedOther = $0004;
RmStatusRestarted = $0008;
RmStatusErrorOnStop = $0010;
RmStatusErrorOnRestart = $0020;
RmStatusShutdownMasked = $0040;
RmStatusRestartMasked = $0080;
RmForceShutdown = $0001;
RmShutdownOnlyRegistered = $0010;
type
SessionKey=array[1..CCH_RM_SESSION_KEY+1] of Char;
FILETIME=record
dwLowDateTime,dwHighDateTime:DWORD;
end;
RM_UNIQUE_PROCESS=record
dwProcessId:DWORD;
ProcessStartTime:FILETIME;
end;
RM_APP_TYPE=DWORD;
RM_PROCESS_INFO=record
Process:RM_UNIQUE_PROCESS;
strAppName:array[1..CCH_RM_MAX_APP_NAME+1] of Char;
strServiceShortName:array[1..CCH_RM_MAX_SVC_NAME+1] of Char;
ApplicationType:RM_APP_TYPE;
AppStatus:ULONG;
TSSessionId:DWORD;
bRestartable:BOOL;
end;
RM_WRITE_STATUS_CALLBACK=DWORD;
function RmStartSession(var pSessionHandle:DWORD;dwSessionFlags:DWORD;strSessionKey:SessionKey):DWORD;
external 'RmStartSession#Rstrtmgr.dll stdcall delayload';
function RmEndSession(dwSessionHandle:DWORD):DWORD;
external 'RmEndSession#Rstrtmgr.dll stdcall delayload';
function RmRegisterResources(dwSessionHandle:DWORD;hFiles:UINT;rgsFilenames:TArrayOfString;nApplications:UINT;rgApplications:array of RM_UNIQUE_PROCESS;nServices:UINT;rgsServiceNames:TArrayOfString):DWORD;
external 'RmRegisterResources#Rstrtmgr.dll stdcall delayload';
function RmGetList(dwSessionHandle:DWORD;var pnProcInfoNeeded,pnProcInfo:UINT;rgAffectedApps:array of RM_PROCESS_INFO;var lpdwRebootReasons:DWORD):DWORD;
external 'RmGetList#Rstrtmgr.dll stdcall delayload';
function RmShutdown(dwSessionHandle:DWORD;lActionFlags:ULONG;fnStatus:RM_WRITE_STATUS_CALLBACK):DWORD;
external 'RmShutdown#Rstrtmgr.dll stdcall delayload';
function RmRestart(dwSessionHandle:DWORD;dwRestartFlags:DWORD;fnStatus:RM_WRITE_STATUS_CALLBACK):DWORD;
external 'RmRestart#Rstrtmgr.dll stdcall delayload';
var
Processes: ProcessList;
RestartManagerHandle:DWORD;
{-------------------------------------------------------------------------}
{ Returns a list of running processes that currectly use one of the specified modules. }
{ Each module has to be a full path and filename to a DLL. }
function FindProcessesUsingModules(Modules:TArrayOfString;var Processes:ProcessList):DWORD;
var
Handle:DWORD;
Name:SessionKey;
Apps:array of RM_UNIQUE_PROCESS;
Services:TArrayOfString;
Path:String;
PathLength:DWORD;
Needed,Have,i:UINT;
AppList:array of RM_PROCESS_INFO;
RebootReason:DWORD;
Success:DWORD;
begin
SetArrayLength(Processes,0);
Result:=INVALID_HANDLE_VALUE;
{ NULL-terminate the array of chars. }
Name[CCH_RM_SESSION_KEY+1]:=#0;
if RmStartSession(Handle,0,Name)<>ERROR_SUCCESS then begin
Exit;
end;
if RmRegisterResources(Handle,GetArrayLength(Modules),Modules,0,Apps,0,Services)=ERROR_SUCCESS then begin
{ Reallocate the arrays until they are large enough to hold the process information. }
Needed:=1;
repeat
Have:=Needed;
SetArrayLength(AppList,Have);
Success:=RmGetList(Handle,Needed,Have,AppList,RebootReason);
until (Success<>ERROR_MORE_DATA) or (Have>=Needed);
if (Success=ERROR_SUCCESS) and (Needed>0) then begin
for i:=0 to Needed-1 do begin
{ append to end of list }
Have:=GetArrayLength(Processes);
SetArrayLength(Processes,Have+1);
{ assign values to new entry }
Processes[Have].ID:=AppList[i].Process.dwProcessId;
Processes[Have].Name:=ArrayToString(AppList[i].strAppName);
Processes[Have].Restartable:=AppList[i].bRestartable;
Processes[Have].ToTerminate:=True;
end;
Result:=Handle;
end;
end;
if (Result=INVALID_HANDLE_VALUE) then
RmEndSession(Handle);
end;
{-------------------------------------------------------------------------}
{ Returns a list of running processes that currectly use the specified module.
{ The module has to be a full path and filename to a DLL. This starts the }
{ RestartManager and returns its handle or INVALID_HANDLE_VALUE if failed }
{ or nothing has lock }
function FindProcessesUsingModule(Module:String;var Processes:ProcessList):DWORD;
var
Modules:TArrayOfString;
begin
SetArrayLength(Modules,1);
Modules[0]:=Module;
Result:=FindProcessesUsingModules(Modules,Processes);
end;
{-------------------------------------------------------------------------}
var
UninstallDelDataPage: TNewNotebookPage;
UninstallConfirmPage: TNewNotebookPage;
UninstallProcessListPage: TNewNotebookPage;
UninstallBackButton: TNewButton;
UninstallNextButton: TNewButton;
UninstallAutoCloseRB: TNewRadioButton;
DeleteAppDataCheckBox: TNewCheckBox;
AppData: String;
{-------------------------------------------------------------------------}
procedure UpdateUninstallWizard;
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallDelDataPage then
begin
UninstallProgressForm.PageNameLabel.Caption := 'Select Data Uninstall Options';
UninstallProgressForm.PageDescriptionLabel.Caption := 'What data, if any, should be deleted?';
end
else
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallConfirmPage then
begin
UninstallProgressForm.PageNameLabel.Caption := 'Confirm Uninstall';
UninstallProgressForm.PageDescriptionLabel.Caption := 'Confirm the uninstall options below.';
end
else
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallProcessListPage then
begin
UninstallProgressForm.PageNameLabel.Caption := 'Preparing to Uninstall';
UninstallProgressForm.PageDescriptionLabel.Caption := 'Uninstall is preparing to uninstall {#MyAppName} from your computer.'
end;
UninstallBackButton.Visible :=
(UninstallProgressForm.InnerNotebook.ActivePage = UninstallConfirmPage) or
((UninstallProgressForm.InnerNotebook.ActivePage = UninstallDelDataPage) and (UninstallProcessListPage<>nil));
if (UninstallProgressForm.InnerNotebook.ActivePage = UninstallDelDataPage) or
((UninstallProgressForm.InnerNotebook.ActivePage = UninstallProcessListPage) and (UninstallDelDataPage<>nil)) then
begin
UninstallNextButton.Caption := SetupMessage(msgButtonNext);
UninstallNextButton.ModalResult := mrNone;
end
else
begin
UninstallNextButton.Caption := 'Uninstall';
{ Make the "Uninstall" button break the ShowModal loop }
UninstallNextButton.ModalResult := mrOK;
end;
end;
{-------------------------------------------------------------------------}
procedure CreateUninstallConfirmPage();
var
PageText: TNewStaticText;
begin
{ Create the second page }
if (UninstallConfirmPage<>nil) then UninstallConfirmPage.Free();
UninstallConfirmPage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallConfirmPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallConfirmPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallConfirmPage.Align := alClient;
PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallConfirmPage;
PageText.Top := UninstallProgressForm.StatusLabel.Top;
PageText.Left := UninstallProgressForm.StatusLabel.Left;
PageText.Width := UninstallProgressForm.StatusLabel.Width;
PageText.Height := UninstallProgressForm.StatusLabel.Height;
PageText.AutoSize := True;
PageText.Wordwrap := True;
PageText.ShowAccelChar := False;
PageText.Font.Size := 9;
PageText.Caption := 'Click Uninstall to continue with removal of {#MyAppName}.';
if DeleteAppDataCheckBox.Checked then
PageText.Caption := PageText.Caption + #13#10#10 + 'WARNING: Application data will be deleted.';
end;
{-------------------------------------------------------------------------}
procedure UninstallNextButtonClick(Sender: TObject);
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallConfirmPage then
begin
UninstallNextButton.Visible := False;
UninstallBackButton.Visible := False;
end
else
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallDelDataPage then
begin
CreateUninstallConfirmPage();
UninstallProgressForm.InnerNotebook.ActivePage := UninstallConfirmPage;
end
else if UninstallDelDataPage<>nil then
begin
UninstallProgressForm.InnerNotebook.ActivePage := UninstallDelDataPage;
end
else
begin
UninstallNextButton.Visible := False;
UninstallBackButton.Visible := False;
end;
UpdateUninstallWizard;
end;
end;
{-------------------------------------------------------------------------}
procedure UninstallBackButtonClick(Sender: TObject);
begin
if UninstallProgressForm.InnerNotebook.ActivePage = UninstallConfirmPage then
begin
UninstallProgressForm.InnerNotebook.ActivePage := UninstallDelDataPage;
end
else if (UninstallProgressForm.InnerNotebook.ActivePage = UninstallDelDataPage) and (UninstallProcessListPage<>Nil) then
begin
UninstallProgressForm.InnerNotebook.ActivePage := UninstallProcessListPage;
end;
UpdateUninstallWizard;
end;
{-------------------------------------------------------------------------}
procedure InitializeUninstallProgressForm();
var
PageText: TNewStaticText;
PageNameLabel: string;
PageDescriptionLabel: string;
CancelButtonEnabled: Boolean;
CancelButtonModalResult: Integer;
appinstalled: Boolean;
top : Integer;
ListBox : TNewListBox;
i:Integer;
UninstallNoCloseRB : TNewRadioButton;
begin
RestartManagerHandle:=FindProcessesUsingModule(ExpandConstant('{app}\MyModule.dll'), Processes);
if not UninstallSilent then
begin
{ save labels / description }
PageNameLabel := UninstallProgressForm.PageNameLabel.Caption;
PageDescriptionLabel := UninstallProgressForm.PageDescriptionLabel.Caption;
if RestartManagerHandle<>INVALID_HANDLE_VALUE then
begin
UninstallProcessListPage:=TNewNotebookPage.Create(UninstallProgressForm);
UninstallProcessListPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallProcessListPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallProcessListPage.Align := alClient;
PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallProcessListPage;
PageText.Top := UninstallProgressForm.StatusLabel.Top;
PageText.Left := UninstallProgressForm.StatusLabel.Left;
PageText.Width := UninstallProgressForm.StatusLabel.Width;
PageText.Height := UninstallProgressForm.StatusLabel.Height;
PageText.AutoSize := True;
PageText.WordWrap := True;
PageText.ShowAccelChar := False;
PageText.Caption := 'The following applications are using files that need to be removed by the uninstaller. It is recommended that you allow Uninstall to automatically close these applications. After uninstall has completed, it will attempt to restart the applications.';
ListBox := TNewListBox.Create(UninstallProgressForm);
ListBox.Parent := UninstallProcessListPage;
ListBox.Top := PageText.Top + PageText.Height + 16;
ListBox.Left := PageText.Left;
ListBox.Width := PageText.Width;
ListBox.Height := ScaleY(97);
ListBox.TabStop:=False;
for i:=0 to GetArraylength(Processes)-1 do
begin
ListBox.Items.Add(Processes[i].Name);
end;
ListBox.ItemIndex:=-1;
UninstallAutoCloseRB := TNewRadioButton.Create(UninstallProgressForm);
UninstallAutoCloseRB .Parent := UninstallProcessListPage;
UninstallAutoCloseRB .Checked := True;
UninstallAutoCloseRB .Top := ListBox.Top+ListBox.Height+8;
UninstallAutoCloseRB .Left := ListBox.Left;
UninstallAutoCloseRB .Width := ListBox.Width;
UninstallAutoCloseRB.Font.Size := 9;
UninstallAutoCloseRB.Caption := '&Automatically close the applications';
UninstallNoCloseRB := TNewRadioButton.Create(UninstallProgressForm);
UninstallNoCloseRB .Parent := UninstallProcessListPage;
UninstallNoCloseRB .Checked := False;
UninstallNoCloseRB .Top := UninstallAutoCloseRB.Top+UninstallAutoCloseRB.Height+8;
UninstallNoCloseRB .Left := UninstallAutoCloseRB.Left;
UninstallNoCloseRB .Width := UninstallAutoCloseRB.Width;
UninstallNoCloseRB .Font.Size := 9;
UninstallNoCloseRB .Caption := '&Do not close the applications';
{ make page active }
UninstallProgressForm.InnerNotebook.ActivePage := UninstallProcessListPage;
end;
{ work around elevated uninstaller for single user}
AppData:=GetEnv('AppData');
Log('AppData reported as' + AppData);
if AppData<>'' then
begin
appinstalled:=FileExists(ExpandConstant('{app}/myapp.exe'));
if appinstalled then
begin
{ Create the first page and make it active }
UninstallDelDataPage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallDelDataPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallDelDataPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallDelDataPage.Align := alClient;
PageText := TNewStaticText.Create(UninstallProgressForm);
PageText.Parent := UninstallDelDataPage;
PageText.Top := UninstallProgressForm.StatusLabel.Top;
PageText.Left := UninstallProgressForm.StatusLabel.Left;
PageText.Width := UninstallProgressForm.StatusLabel.Width;
PageText.Height := UninstallProgressForm.StatusLabel.Height;
PageText.AutoSize := True;
PageText.WordWrap := True;
PageText.ShowAccelChar := False;
PageText.Caption := 'You have the option to delete the data assoicated with App Name';
top:=PageText.Top + PageText.Height + 16;
if appinstalled then
begin
DeleteAppDataCheckBox := TNewCheckBox.Create(UninstallProgressForm);
DeleteAppDataCheckBox.Parent := UninstallDelDataPage;
DeleteAppDataCheckBox.Checked := False;
DeleteAppDataCheckBox.Top := top;
DeleteAppDataCheckBox.Left := PageText.Left+10;
DeleteAppDataCheckBox.Width := PageText.Width - 10;
DeleteAppDataCheckBox.Font.Size := 9;
DeleteAppDataCheckBox.Caption := 'Delete all App Data';
top:=DeleteAppDataCheckBox.Top + DeleteAppDataCheckBox.Height + 8;
end;
{ set as first page if not already set }
if UninstallProgressForm.InnerNotebook.ActivePage=UninstallProgressForm.InstallingPage then
UninstallProgressForm.InnerNotebook.ActivePage:=UninstallDelDataPage;
{ next button }
UninstallNextButton := TNewButton.Create(UninstallProgressForm);
UninstallNextButton.Parent := UninstallProgressForm;
UninstallNextButton.Left := UninstallProgressForm.CancelButton.Left - UninstallProgressForm.CancelButton.Width - ScaleX(10);
UninstallNextButton.Top := UninstallProgressForm.CancelButton.Top;
UninstallNextButton.Width := UninstallProgressForm.CancelButton.Width;
UninstallNextButton.Height := UninstallProgressForm.CancelButton.Height;
UninstallNextButton.OnClick := #UninstallNextButtonClick;
{ back button }
UninstallBackButton := TNewButton.Create(UninstallProgressForm);
UninstallBackButton.Parent := UninstallProgressForm;
UninstallBackButton.Left := UninstallNextButton.Left - UninstallNextButton.Width - ScaleX(10);
UninstallBackButton.Top := UninstallProgressForm.CancelButton.Top;
UninstallBackButton.Width := UninstallProgressForm.CancelButton.Width;
UninstallBackButton.Height := UninstallProgressForm.CancelButton.Height;
UninstallBackButton.Caption := SetupMessage(msgButtonBack);
UninstallBackButton.OnClick := #UninstallBackButtonClick;
{ setup tab order }
UninstallBackButton.TabOrder := UninstallProgressForm.CancelButton.TabOrder;
UninstallNextButton.TabOrder := UninstallBackButton.TabOrder + 1;
UninstallProgressForm.CancelButton.TabOrder := UninstallNextButton.TabOrder + 1;
{ Run our wizard pages }
UpdateUninstallWizard;
CancelButtonEnabled := UninstallProgressForm.CancelButton.Enabled
UninstallProgressForm.CancelButton.Enabled := True;
{ save value }
CancelButtonModalResult := UninstallProgressForm.CancelButton.ModalResult;
{ set value to use }
UninstallProgressForm.CancelButton.ModalResult := mrCancel;
if UninstallProgressForm.ShowModal = mrCancel then
begin
if RestartManagerHandle<>INVALID_HANDLE_VALUE then
begin
RmEndSession(RestartManagerHandle);
RestartManagerHandle:=INVALID_HANDLE_VALUE;
end;
Abort;
end;
{ Restore the standard page payout }
UninstallProgressForm.CancelButton.Enabled := CancelButtonEnabled;
UninstallProgressForm.CancelButton.ModalResult := CancelButtonModalResult;
UninstallProgressForm.PageNameLabel.Caption := PageNameLabel;
UninstallProgressForm.PageDescriptionLabel.Caption := PageDescriptionLabel;
UninstallProgressForm.InnerNotebook.ActivePage := UninstallProgressForm.InstallingPage;
end;
end;
end;
end;
{-------------------------------------------------------------------------}
function IsDeleteAppData: Boolean;
begin
Result:=(DeleteAppDataCheckBox<>nil) and DeleteAppDataCheckBox.Checked;
end;
{-------------------------------------------------------------------------}
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ErrorCode: Integer;
Res : Boolean;
begin
if CurUninstallStep = usUninstall then
begin
if (RestartManagerHandle<>INVALID_HANDLE_VALUE) and (UninstallAutoCloseRB<>nil) and (UninstallAutoCloseRB.Checked) then
RmShutdown(RestartManagerHandle, 0, 0);
end
else if CurUninstallStep = usPostUninstall then
begin
if IsDeleteAppData then
begin
Res:=DelTree(AppData+'\MyAppDataDir', true, true, true);
Log('Delete '+AppData+'\MyAppDataDir result: '+IntToStr(Integer(Res)));
end;
if (RestartManagerHandle<>INVALID_HANDLE_VALUE) and (UninstallAutoCloseRB<>nil) and (UninstallAutoCloseRB.Checked) then
RmRestart(RestartManagerHandle, 0, 0);
if (RestartManagerHandle<>INVALID_HANDLE_VALUE) then
begin
RmEndSession(RestartManagerHandle);
RestartManagerHandle:=INVALID_HANDLE_VALUE;
end;
end;
end;
How do I WelcomeLabel on Inno Setup does not appear and leave only the text over the image.
This is that i want.
Something like this might do the trick. Since the welcome labels don't support transparency, you need to workaround this by creating your own with a different class (that has a transparency support), inherit the parent, font, text and size and hide the original ones. Here is the script how to do this:
[Code]
procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
ATarget.Left := ASource.Left;
ATarget.Top := ASource.Top;
ATarget.Width := ASource.Width;
ATarget.Height := ASource.Height;
end;
procedure InitializeWizard;
var
TopWelcomeLabel: TLabel;
BottomWelcomeLabel: TLabel;
begin
WizardForm.WizardBitmapImage.Align := alClient;
WizardForm.WizardBitmapImage.Bitmap.LoadFromFile('D:\Image.bmp');
TopWelcomeLabel := TLabel.Create(WizardForm);
TopWelcomeLabel.Parent := WizardForm.WelcomeLabel1.Parent;
TopWelcomeLabel.Font := WizardForm.WelcomeLabel1.Font;
TopWelcomeLabel.Caption := WizardForm.WelcomeLabel1.Caption;
TopWelcomeLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel1, TopWelcomeLabel);
WizardForm.WelcomeLabel1.Visible := False;
BottomWelcomeLabel := TLabel.Create(WizardForm);
BottomWelcomeLabel.Parent := WizardForm.WelcomeLabel2.Parent;
BottomWelcomeLabel.Font := WizardForm.WelcomeLabel2.Font;
BottomWelcomeLabel.Caption := WizardForm.WelcomeLabel2.Caption;
BottomWelcomeLabel.WordWrap := WizardForm.WelcomeLabel2.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel2, BottomWelcomeLabel);
WizardForm.WelcomeLabel2.Visible := False;
end;
And the result:
I'm afraid what you want may not be possible or rather difficult, even if creating a custom page. Have a look at the CreateCustomPage() function and the example scripts included with your Inno Setup installation.
This code can help you. Just change the Welcome page, but you can try with other pages of the installer.
[code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
end;
function GetCustomSetupExitCode(): Integer;
begin
Result := 1;
end;
procedure InitializeWizard();
var
WLabel1, WLabel2,
FLabel1, FLabel2: TLabel;
begin
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.FinishedHeadingLabel.Hide;
WizardForm.FinishedLabel.Hide;
WizardForm.WizardBitmapImage.Width := 500;
WizardForm.WizardBitmapImage.Height := 315;
WLabel1 := TLabel.Create(WizardForm);
WLabel1.Left := ScaleX(176);
WLabel1.Top := ScaleY(16);
WLabel1.Width := ScaleX(301);
WLabel1.Height := ScaleY(54);
WLabel1.AutoSize := False;
WLabel1.WordWrap := True;
WLabel1.Font.Name := 'verdana';
WLabel1.Font.Size := 12;
WLabel1.Font.Style := [fsBold];
WLabel1.Font.Color:= clBlack;
WLabel1.ShowAccelChar := False;
WLabel1.Caption := WizardForm.WelcomeLabel1.Caption;
WLabel1.Transparent := True;
WLabel1.Parent := WizardForm.WelcomePage;
WLabel2 :=TLabel.Create(WizardForm);
WLabel2.Top := ScaleY(76);
WLabel2.Left := ScaleX(176);
WLabel2.Width := ScaleX(301);
WLabel2.Height := ScaleY(234);
WLabel2.AutoSize := False;
WLabel2.WordWrap := True;
WLabel2.Font.Name := 'tahoma';
WLabel2.Font.Color:= clBlack;
WLabel2.ShowAccelChar := False;
WLabel2.Caption := WizardForm.WelcomeLabel2.Caption;
WLabel2.Transparent := True;
WLabel2.Parent := WizardForm.WelcomePage;
WizardForm.WizardBitmapImage2.Width := 500;
WizardForm.WizardBitmapImage2.Height := 315;
FLabel1 := TLabel.Create(WizardForm);
FLabel1.Left := ScaleX(176);
FLabel1.Top := ScaleY(16);
FLabel1.Width := ScaleX(301);
FLabel1.Height := ScaleY(54);
FLabel1.AutoSize := False;
FLabel1.WordWrap := True;
FLabel1.Font.Name := 'verdana';
FLabel1.Font.Size := 12;
FLabel1.Font.Style := [fsBold];
FLabel1.Font.Color:= clBlack;
FLabel1.ShowAccelChar := False;
FLabel1.Caption := WizardForm.FinishedHeadingLabel.Caption;
FLabel1.Transparent := True;
FLabel1.Parent := WizardForm.FinishedPage;
FLabel2 :=TLabel.Create(WizardForm);
FLabel2.Top := ScaleY(76);
FLabel2.Left := ScaleX(176);
FLabel2.Width := ScaleX(301);
FLabel2.Height := ScaleY(53);
FLabel2.AutoSize := False;
FLabel2.WordWrap := True;
FLabel2.Font.Name := 'tahoma';
FLabel2.Font.Color:= clBlack;
FLabel2.ShowAccelChar := False;
FLabel2.Caption := WizardForm.FinishedLabel.Caption;
FLabel2.Transparent := True;
FLabel2.Parent := WizardForm.FinishedPage;
end;
I have this part of code which adjusts my welcome page but the finished page is still default Inno page with the ugly wizardpicture on the side. I want to do the same thing to finished page as i did with welcome
[Code]
procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
ATarget.Left := 210;
ATarget.Top := ASource.Top;
ATarget.Width := 295;
ATarget.Height := ASource.Height;
end;
procedure InitializeWizard;
var
TopWelcomeLabel: TLabel;
BottomWelcomeLabel: TLabel;
begin
WizardForm.WizardBitmapImage.Align := alClient;
WizardForm.WizardBitmapImage.Bitmap.LoadFromFile('Q:\Inno\wizardimages\new\bmp.bmp');
TopWelcomeLabel := TLabel.Create(WizardForm);
TopWelcomeLabel.Parent := WizardForm.WelcomeLabel1.Parent;
TopWelcomeLabel.Font := WizardForm.WelcomeLabel1.Font;
TopWelcomeLabel.Caption := WizardForm.WelcomeLabel1.Caption;
TopWelcomeLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel1, TopWelcomeLabel);
WizardForm.WelcomeLabel1.Visible := False;
BottomWelcomeLabel := TLabel.Create(WizardForm);
BottomWelcomeLabel.Parent := WizardForm.WelcomeLabel2.Parent;
BottomWelcomeLabel.Font := WizardForm.WelcomeLabel2.Font;
BottomWelcomeLabel.Caption := WizardForm.WelcomeLabel2.Caption;
BottomWelcomeLabel.WordWrap := WizardForm.WelcomeLabel2.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel2, BottomWelcomeLabel);
WizardForm.WelcomeLabel2.Visible := False;
end;
EDITED WITH SOLUTION:
And now with the help of the guy bellow this is the new code that seems to work great
[Code]
procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
ATarget.Left := 210;
ATarget.Top := ASource.Top;
ATarget.Width := 295;
ATarget.Height := ASource.Height;
end;
procedure InitializeWizard;
var
TopWelcomeLabel: TLabel;
BottomWelcomeLabel: TLabel;
begin
WizardForm.WizardBitmapImage.Align := alClient;
WizardForm.WizardBitmapImage.Bitmap.LoadFromFile('bmp.bmp');
TopWelcomeLabel := TLabel.Create(WizardForm);
TopWelcomeLabel.Parent := WizardForm.WelcomeLabel1.Parent;
TopWelcomeLabel.Font := WizardForm.WelcomeLabel1.Font;
TopWelcomeLabel.Caption := WizardForm.WelcomeLabel1.Caption;
TopWelcomeLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel1, TopWelcomeLabel);
WizardForm.WelcomeLabel1.Visible := False;
BottomWelcomeLabel := TLabel.Create(WizardForm);
BottomWelcomeLabel.Parent := WizardForm.WelcomeLabel2.Parent;
BottomWelcomeLabel.Font := WizardForm.WelcomeLabel2.Font;
BottomWelcomeLabel.Caption := WizardForm.WelcomeLabel2.Caption;
BottomWelcomeLabel.WordWrap := WizardForm.WelcomeLabel2.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel2, BottomWelcomeLabel);
WizardForm.WelcomeLabel2.Visible := False;
WizardForm.WizardBitmapImage2.Align := alClient;
//Stackoverflow changes start here...
WizardForm.WizardBitmapImage2.Bitmap.LoadFromFile('bmp.bmp');
WizardForm.FinishedLabel.Left := 210;
WizardForm.FinishedLabel.Width := 265;
WizardForm.FinishedHeadingLabel.Left := 210;
WizardForm.FinishedHeadingLabel.Width := 265
WizardForm.RunList.Left := 210;
end;
The component names from the final page are:
FinishedLabel
FinishedHeadingLabel
WizardBitmapImage2
I've marked them in this picture:
How do I WelcomeLabel on Inno Setup does not appear and leave only the text over the image.
This is that i want.
Something like this might do the trick. Since the welcome labels don't support transparency, you need to workaround this by creating your own with a different class (that has a transparency support), inherit the parent, font, text and size and hide the original ones. Here is the script how to do this:
[Code]
procedure InheritBoundsRect(ASource, ATarget: TControl);
begin
ATarget.Left := ASource.Left;
ATarget.Top := ASource.Top;
ATarget.Width := ASource.Width;
ATarget.Height := ASource.Height;
end;
procedure InitializeWizard;
var
TopWelcomeLabel: TLabel;
BottomWelcomeLabel: TLabel;
begin
WizardForm.WizardBitmapImage.Align := alClient;
WizardForm.WizardBitmapImage.Bitmap.LoadFromFile('D:\Image.bmp');
TopWelcomeLabel := TLabel.Create(WizardForm);
TopWelcomeLabel.Parent := WizardForm.WelcomeLabel1.Parent;
TopWelcomeLabel.Font := WizardForm.WelcomeLabel1.Font;
TopWelcomeLabel.Caption := WizardForm.WelcomeLabel1.Caption;
TopWelcomeLabel.WordWrap := WizardForm.WelcomeLabel1.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel1, TopWelcomeLabel);
WizardForm.WelcomeLabel1.Visible := False;
BottomWelcomeLabel := TLabel.Create(WizardForm);
BottomWelcomeLabel.Parent := WizardForm.WelcomeLabel2.Parent;
BottomWelcomeLabel.Font := WizardForm.WelcomeLabel2.Font;
BottomWelcomeLabel.Caption := WizardForm.WelcomeLabel2.Caption;
BottomWelcomeLabel.WordWrap := WizardForm.WelcomeLabel2.WordWrap;
InheritBoundsRect(WizardForm.WelcomeLabel2, BottomWelcomeLabel);
WizardForm.WelcomeLabel2.Visible := False;
end;
And the result:
I'm afraid what you want may not be possible or rather difficult, even if creating a custom page. Have a look at the CreateCustomPage() function and the example scripts included with your Inno Setup installation.
This code can help you. Just change the Welcome page, but you can try with other pages of the installer.
[code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
end;
function GetCustomSetupExitCode(): Integer;
begin
Result := 1;
end;
procedure InitializeWizard();
var
WLabel1, WLabel2,
FLabel1, FLabel2: TLabel;
begin
WizardForm.WelcomeLabel1.Hide;
WizardForm.WelcomeLabel2.Hide;
WizardForm.FinishedHeadingLabel.Hide;
WizardForm.FinishedLabel.Hide;
WizardForm.WizardBitmapImage.Width := 500;
WizardForm.WizardBitmapImage.Height := 315;
WLabel1 := TLabel.Create(WizardForm);
WLabel1.Left := ScaleX(176);
WLabel1.Top := ScaleY(16);
WLabel1.Width := ScaleX(301);
WLabel1.Height := ScaleY(54);
WLabel1.AutoSize := False;
WLabel1.WordWrap := True;
WLabel1.Font.Name := 'verdana';
WLabel1.Font.Size := 12;
WLabel1.Font.Style := [fsBold];
WLabel1.Font.Color:= clBlack;
WLabel1.ShowAccelChar := False;
WLabel1.Caption := WizardForm.WelcomeLabel1.Caption;
WLabel1.Transparent := True;
WLabel1.Parent := WizardForm.WelcomePage;
WLabel2 :=TLabel.Create(WizardForm);
WLabel2.Top := ScaleY(76);
WLabel2.Left := ScaleX(176);
WLabel2.Width := ScaleX(301);
WLabel2.Height := ScaleY(234);
WLabel2.AutoSize := False;
WLabel2.WordWrap := True;
WLabel2.Font.Name := 'tahoma';
WLabel2.Font.Color:= clBlack;
WLabel2.ShowAccelChar := False;
WLabel2.Caption := WizardForm.WelcomeLabel2.Caption;
WLabel2.Transparent := True;
WLabel2.Parent := WizardForm.WelcomePage;
WizardForm.WizardBitmapImage2.Width := 500;
WizardForm.WizardBitmapImage2.Height := 315;
FLabel1 := TLabel.Create(WizardForm);
FLabel1.Left := ScaleX(176);
FLabel1.Top := ScaleY(16);
FLabel1.Width := ScaleX(301);
FLabel1.Height := ScaleY(54);
FLabel1.AutoSize := False;
FLabel1.WordWrap := True;
FLabel1.Font.Name := 'verdana';
FLabel1.Font.Size := 12;
FLabel1.Font.Style := [fsBold];
FLabel1.Font.Color:= clBlack;
FLabel1.ShowAccelChar := False;
FLabel1.Caption := WizardForm.FinishedHeadingLabel.Caption;
FLabel1.Transparent := True;
FLabel1.Parent := WizardForm.FinishedPage;
FLabel2 :=TLabel.Create(WizardForm);
FLabel2.Top := ScaleY(76);
FLabel2.Left := ScaleX(176);
FLabel2.Width := ScaleX(301);
FLabel2.Height := ScaleY(53);
FLabel2.AutoSize := False;
FLabel2.WordWrap := True;
FLabel2.Font.Name := 'tahoma';
FLabel2.Font.Color:= clBlack;
FLabel2.ShowAccelChar := False;
FLabel2.Caption := WizardForm.FinishedLabel.Caption;
FLabel2.Transparent := True;
FLabel2.Parent := WizardForm.FinishedPage;
end;