Home IssProc Using IssProc with NSIS to detect files in use
formats

Using IssProc with NSIS to detect files in use

Although IssProc was specially designed for Inno Setup scripts, you can also use it with other setup scripts like NSIS (Nullsoft Scriptable Install System)

Here is a few steps you need to do in order to use IssProc with NSIS to detect if any of the application files are in use, the application(s) that keeps the file(s) locked/in use will be listed:

1. Extract/Copy IssProc to the nsis plugins temp folder

SetOutPath $PLUGINSDIR
File "IssProc.dll"   ; copy iss proc to plugins temp folder

2. Enable the “any file type in use” feature for the destination folder only.

System::Call "IssProc::IssEnableAnyFileInUseCheck(t '$INSTDIR')"

3. Check for locked files (in use) in the destination folder:

  System::Call "IssProc::IssFindModule(i $HWNDPARENT, t '$INSTDIR*', t '', i 0,i 1) i .r0 ? u"
  ;IssFindModule returns: 0 if no module or file in use found; 1 if cancel pressed; 2 if ignore pressed; -1 if an error occured
  IntCmp $0 1 is1 is0 is2
   is0:
    Goto setup_continue
   is1:
    ;SendMessage $HWNDPARENT ${WM_CLOSE} 0 0
    Quit
   is2:
    Goto setup_continue

 setup_continue:

  System::Free 0
  Delete $PLUGINSDIR\IssProc.dll  ;remove the module or just let nsis remove it...

Download the complete nsis setup project along with the IssProc extension from here.

 
Tags: application that locked file, file in use, , nsis locked file
  Share on Reddit
No Comments  comments 
© rlByte Software
credit