|
  
|
1#
发表于 2008-10-30 10:21 AM
| 只看该作者
Files-In-Use Extension for Inno Setup
http://raz-soft.com/display-engl ... ion-for-inno-setup/
Files-In-Use functionality is among the countless services that Windows Installer exposes for setup authors to leverage for their application install/maintenance. This functionality lets setup authors display the processes that hold on to files that would be updated by this install. The user would want to shut those processes before continuing with the install to ensure that the install wouldn’t require a reboot.
[Files In Use Extension for Inno Setup] Now you can do the same thing with Inno Setup avoiding unnecessary reboots when installing your application exe files / plugin / shell extension / ocx etc with My Files In Use Extension for Inno Setup
Features:
* small size (it will add less than 20KB to your setup. )
* multi-language support (you can add or modify the language file)
100% FREE AWARD
* multiple file search (a semicolon list with exe/dll/ocx names and path can be used)
* wildcard file match ( * = matches any characters, zero or more times ; ? = matches any character, one time )
* exact folder match (detect if your file is in use only from a specified folder )
* applications exe names will be listed not just their description
* both 32 and 64 bit applications detection (Vista & XP x64 )
* user friendly: applications are displayed along with their icon
* possibility to end the detected process forcedly (right click on process for more options)
* easy to use and 100% free; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=My Program
AppVerName=My Program 1.5
AppPublisher=My Company, Inc.
AppPublisherURL=http://www.mycompany.com
AppSupportURL=http://www.mycompany.com
AppUpdatesURL=http://www.mycompany.com
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
[Files]
;------ add IssProc (Files In Use Extension)
Source: IssProc.dll; DestDir: {tmp}; Flags: dontcopy
;------ add IssProc extra language file (you don't need to add this file if you are using english only)
Source: IssProcLanguage.ini; DestDir: {tmp}; Flags: dontcopy
;------ Copy IssProc in your app folder if you want to use it on unistall
Source: IssProc.dll; DestDir: {app}
Source: IssProcLanguage.ini; DestDir: {app}
;------
Source: compiler:MyProg.exe; DestDir: {app}; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: {group}\My Program; Filename: {app}\MyProg.exe
Name: {userdesktop}\My Program; Filename: {app}\MyProg.exe; Tasks: desktopicon
Name: {group}\Uninstall My Program; Filename: {uninstallexe}
[Run]
Filename: {app}\MyProg.exe; Description: {cm:LaunchProgram,My Program}; Flags: nowait postinstall skipifsilent
[Code]
// IssFindModule called on install
function IssFindModule(hWnd: Integer; Modulename: PChar; Language: PChar; Silent: Boolean; CanIgnore: Boolean ): Integer;
external 'IssFindModule@files:IssProc.dll stdcall setuponly';
// IssFindModule called on uninstall
function IssFindModuleU(hWnd: Integer; Modulename: PChar; Language: PChar; Silent: Boolean; CanIgnore: Boolean ): Integer;
external 'IssFindModule@{app}\IssProc.dll stdcall uninstallonly';
//********************************************************************************************************************************************
// IssFindModule function returns: 0 if no module found; 1 if cancel pressed; 2 if ignore pressed; -1 if an error occured
//
// hWnd = main wizard window handle.
//
// Modulename = module name(s) to check. You can use a full path to a DLL/EXE/OCX or wildcard file name/path. Separate multiple modules with semicolon.
// Example1 : Modulename='*mymodule.dll'; - will search in any path for mymodule.dll
// Example2 : Modulename=ExpandConstant('{app}\mymodule.dll'); - will search for mymodule.dll only in {app} folder (the application directory)
// Example3 : Modulename=ExpandConstant('{app}\mymodule.dll;*myApp.exe'); - just like Example2 + search for myApp.exe regardless of his path.
//
// Language = files in use language dialog. Set this value to empty '' and default english will be used
// ( see and include IssProcLanguage.ini if you need custom text or other language)
//
// Silent = silent mode : set this var to true if you don't want to display the files in use dialog.
// When Silent is true IssFindModule will return 1 if it founds the Modulename or 0 if nothing found
//
// CanIgnore = set this var to false to Disable the Ignore button forcing the user to close those applications before continuing
// set this var to true to Enable the Ignore button allowing the user to continue without closing those applications
//******************************************************************************************************************************************
function NextButtonClick(CurPage: Integer): Boolean;
var
hWnd: Integer;
sModuleName: String;
nCode: Integer; {IssFindModule returns: 0 if no module found; 1 if cancel pressed; 2 if ignore pressed; -1 if an error occured }
begin
Result := true;
if CurPage = wpReady then
begin
Result := false;
ExtractTemporaryFile('IssProcLanguage.ini'); { extract extra language file - you don't need to add this line if you are using english only }
hWnd := StrToInt(ExpandConstant('{wizardhwnd}')); { get main wizard handle }
sModuleName :=ExpandConstant('*kernel*.dll;'); { searched modules. Tip: separate multiple modules with semicolon Ex: '*mymodule.dll;*mymodule2.dll;*myapp.exe'}
nCode:=IssFindModule(hWnd,sModuleName,'en',false,true); { search for module and display files-in-use window if found }
//sModuleName:=IntToStr(nCode);
// MsgBox ( sModuleName, mbConfirmation, MB_YESNO or MB_DEFBUTTON2);
if nCode=1 then begin { cancel pressed or files-in-use window closed }
PostMessage (WizardForm.Handle, $0010, 0, 0); { quit setup, $0010=WM_CLOSE }
end else if (nCode=0) or (nCode=2) then begin { no module found or ignored pressed}
Result := true; { continue setup }
end;
end;
end;
function InitializeUninstall(): Boolean;
var
sModuleName: String;
nCode: Integer; {IssFindModule returns: 0 if no module found; 1 if cancel pressed; 2 if ignore pressed; -1 if an error occured }
begin
Result := false;
sModuleName := ExpandConstant('*Myprog.exe;'); { searched module. Tip: separate multiple modules with semicolon Ex: '*mymodule.dll;*mymodule2.dll;*myapp.exe'}
nCode:=IssFindModuleU(0,sModuleName,'enu',false,false); { search for module and display files-in-use window if found }
if (nCode=0) or (nCode=2) then begin { no module found or ignored pressed}
Result := true; { continue setup }
end;
// Unload the extension, otherwise it will not be deleted by the uninstaller
UnloadDLL(ExpandConstant('{app}\IssProc.dll'));
end;
[ 本帖最后由 WLDNA 于 2008-10-30 10:22 AM 编辑 ] |
附件: 您所在的用户组无法下载或查看附件
|