Inno Setup uninstall progress bar change event - inno-setup

Is there any event/function like CurInstallProgressChanged for progressbar with CurProgress and MaxProgress values in Uninstall form in Inno Setup?

There's no native support for this.
What you can do is to setup a timer and watch for changes in the UninstallProgressForm.ProgressBar.Position.
The code may be like:
[Code]
procedure TimerProc(
h: LongWord; AMsg: LongWord; IdEvent: LongWord; dwTime: LongWord);
begin
Log(Format(
'Uninstall progress: %d/%d', [
UninstallProgressForm.ProgressBar.Position,
UninstallProgressForm.ProgressBar.Max]));
end;
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord;
lpTimerFunc: LongWord): LongWord;
external 'SetTimer#user32.dll stdcall';
procedure InitializeUninstallProgressForm();
begin
SetTimer(0, 0, 100, CreateCallback(#TimerProc)); // every 100 ms
end;
For CreateCallback function, you need Inno Setup 6.
If you are stuck with Inno Setup 5, you can use WrapCallback function from InnoTools InnoCallback library (the code needs Unicode version of Inno Setup 5). But using an external DLL library from an uninstaller is tricky and has its drawbacks. See (yours) Load external DLL for uninstall process in Inno Setup. For another solution (better but more complicate to implement), see How keep uninstall files inside uninstaller?

Related

Getting ISSkin to work with latest Inno Setup Unicode

I am trying for the first time ISSkin with Inno Setup. I wanted to try the black style. So I tried their sample:
[Setup]
AppName=ISSkin Example
AppVersion=1.0.0.2
DefaultDirName={pf}\ISSkin
[Files]
; Add the ISSkin DLL used for skinning Inno Setup installations.
Source: ISSkin.dll; DestDir: {app}; Flags: dontcopy
; Add the Visual Style resource contains resources used for skinning,
; you can also use Microsoft Visual Styles (*.msstyles) resources.
Source: Styles\Office2007.cjstyles; DestDir: {tmp}; Flags: dontcopy
[Icons]
Name: {group}\Uninstall =ISSkin; Filename: {app}\unins000.exe
[Code]
// The following code block is used to load the ISS, pass in
// NormalBlack.ini as the second parameter to LoadSkin to use
// the Black color scheme instead of the default Blue color
// scheme.
// Importing LoadSkin API from ISSkin.DLL
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin#files:isskin.dll stdcall';
// Importing UnloadSkin API from ISSkin.DLL
procedure UnloadSkin();
external 'UnloadSkin#files:isskin.dll stdcall';
// Importing ShowWindow Windows API from User32.DLL
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external 'ShowWindow#user32.dll stdcall';
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('Office2007.cjstyles');
LoadSkin(ExpandConstant('{tmp}\Office2007.cjstyles'), 'NormalBlack.ini');
Result := True;
end;
procedure DeinitializeSetup();
begin
// Hide Window before unloading skin so user does not get
// a glimse of an unskinned window before it is closed.
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();
end;
I could not get it to work. The program looked normal.
I notice the software they provide is dated 2010. I am using latest Unicode Inno Setup.
How to do this skinning with it?
With Unicode version of Inno Setup you should use Unicode version of the plugin: ISSkinU.dll.
[Files]
Source: ISSkinU.dll; DestDir: {app}; Flags: dontcopy
[Code]
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin#files:isskinU.dll stdcall';
procedure UnloadSkin();
external 'UnloadSkin#files:isskinU.dll stdcall';
(rest of the code is the same as in your question)

Semi-Transparent Wizard Form

I was working on an Inno Setup design when I faced this mighty question in front of me...How to make the Wizard form semi-transparent?
I know Delphi too so I'm thinking if there is any way we can use FMX's Fill.Color and transparency=true with Inno Setup?
I'm currently using this function for Wizard creation:
procedure CreateWizardForm;
begin
with WizardForm do begin
BorderStyle:=bsNone;
ClientWidth:=900;
ClientHeight:=540;
InnerNotebook.Hide;
OuterNotebook.Hide;
Center;
Bevel.Hide;
NextButton.Width:=0;
CancelButton.Width:=0;
end;
Form:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}')+'\form.png',0,0,900,540,True,True);
end;
Regards
Ramiro
There is Inno Setup plug-in as for NSIS called IsWin7 or MegaFileUpload.
It works for Windows Vista and Windows 7 - both systems support Aero effects.
Keep in mind that iswin7.dll is non-official.
Sample:
[Files]
Source: ".\ISWin7.dll"; DestDir: "{tmp}"; Flags: dontcopy nocompression
[Code]
procedure iswin7_add_glass(Handle:HWND; Left, Top, Right, Bottom : Integer; GDIPLoadMode: boolean);
external 'iswin7_add_glass#files:iswin7.dll stdcall';
procedure iswin7_add_button(Handle:HWND);
external 'iswin7_add_button#files:iswin7.dll stdcall';
procedure iswin7_free;
external 'iswin7_free#files:iswin7.dll stdcall';
procedure InitializeWizard();
begin
iswin7_add_button(WizardForm.BackButton.Handle);
iswin7_add_button(WizardForm.NextButton.Handle);
iswin7_add_button(WizardForm.CancelButton.Handle);
iswin7_add_glass(WizardForm.Handle, 0, 0, 0, ScaleY(47), True);
end;
procedure DeinitializeSetup();
begin
iswin7_free;
end;
Is the feature you are trying to achieve called Aero (from Windows Vista)?
I think this is not possible to do in pure Inno Setup.
Check this NSIS plug-in: http://nsis.sourceforge.net/Aero_plug-in.
It is open source and uses some Windows API functions -- for inspiration.

Code to run after all files are installed

I got the following little function which I need to call after all files of the [Files] section have been copied
procedure DllAfterInstall(platform: Integer);
begin
if not installDriver(platform) then
MsgBox(ExpandConstant('{cm:installDriverFail}'), mbError, MB_OK);
end;
where installDriver(platform) is an external function to one of my dll's.
As soon as I try to call the DllAfterInstall function in the [Run] section like
Filename: "{code:DllAfterInstall}"; Parameters: 0; Check: not IsWin64
I got the error
Invalid prototype for 'DllAfterInstall'
So can anyone tell me what I'm doing wrong? Or maybe is there another way to call a *.dll after all files have been copied? The *.dll function should only be called once so AfterInstall is no option.
Call your code from CurStepChanged event function when CurStep is ssPostInstall:
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
Log('Post install');
DllAfterInstall(platform);
end;
end;
You also need to provide an actual value to the platform parameter of the function.

How to make the bottom part of Inno Setup pages transparent? (screenshot given)

How can I make an Inno Setup installer like this:
I mean, I want to make the bottom part of Inno Setup pages like the above image.
What Pascal coding should I use?
Thanks. :)
The simplest way is to obtain iswin7.dll library from the internet and use it with following code:
[Files]
Source: ".\ISWin7.dll"; DestDir: "{tmp}"; Flags: dontcopy nocompression
[Code]
procedure iswin7_add_glass(Handle:HWND; Left, Top, Right, Bottom : Integer; GDIPLoadMode: boolean);
external 'iswin7_add_glass#files:iswin7.dll stdcall';
procedure iswin7_add_button(Handle:HWND);
external 'iswin7_add_button#files:iswin7.dll stdcall';
procedure iswin7_free;
external 'iswin7_free#files:iswin7.dll stdcall';
procedure InitializeWizard();
begin
iswin7_add_button(WizardForm.BackButton.Handle);
iswin7_add_button(WizardForm.NextButton.Handle);
iswin7_add_button(WizardForm.CancelButton.Handle);
iswin7_add_glass(WizardForm.Handle, 0, 0, 0, ScaleY(47), True);
end;
procedure DeinitializeSetup();
begin
iswin7_free;
end;
Keep in mind that iswin7.dll is non-official.

Linux - XFCE4 - Lazarus system wide hotkey

I have done quite a bit of searching in Google and though I can find the switches to do this for Windows using WM_HOTKEY I cannot find it for Linux.
WM_HOTKEY Hook
uses ...,windows;
var
PrevWndProc: WNDPROC;
const
MY_ID=1;
function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam):LRESULT; stdcall;
begin
if (uMsg=WM_HOTKEY) and (WParam=MY_ID) then
begin
Application.Restore;
end;
result:=CallWindowProc(PrevWndProc,Ahwnd, uMsg, WParam, LParam);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
PrevWndProc:=Windows.WNDPROC(SetWindowLong(Self.Handle,GWL_WNDPROC,PtrInt(#WndCallback)));
RegisterHotKey(Self.Handle,MY_ID,0,vk_F9);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotkey(Self.Handle,MY_ID);
end;
I am looking to place a system wide hotkey hook in XFCE4 and/or XWindows on a linux machine. I know it is possible as many screenshot programs do this all the time no matter what the Window Manager is.
I need for my app to be able to hook a key combo to activate something inside the app but I cannot find anything for this with Lazarus/Pascal on linux anywhere.
Marco knows more about FPC than most (think he wrote it).
In any event you may find the code at the link below helpful and/or other portions of the code base:
http://code.google.com/p/ovoplayer/source/browse/trunk/src/platform/darwin/mmkeys.inc?spec=svn206&r=206

Resources