Archive: Check for loaded DLL or running EXE?


Check for loaded DLL or running EXE?
Hi,

One of the installers I built installs/updates DLL's and EXE's, so I need to first check whether any of the files I might update is currently running.

Does anyone have some NSIS code to check for this?

Thank you
Fred.


FileOpen will do the trick, as it gives error if a file is running (is this right?).


See the attached zip file for the FindProc plugin.
Usage is described in FindProc.txt

I haven't tried it with DLLs, but that might work as well. If not, modify the source code so that it does.


Oops, the plugin.


Slightly modified version of the plugin. Fixed returned values to align with the original author's source code.
Functionally identical to the previous version, only the return values are different.


thanks , I will try it !


Thx to both of you. I'll give this plug-in a try. In the mean time, this code seems to work too:


SetOverwrite try
SetOutPath $SYSDIR
ClearErrors
File "mswinsck.ocx"
IfErrors 0 end
MessageBox MB_OK "Error"
end:


Fred.

This would work only if you actually needed to overwrite the file.
In my case, there were modules I needed to install which could not be done if the main application was running. Using my plugin, I could detect if the main app was running and prompt the user to close it before proceeding. I did not want to overwrite the main app - just check if it was running.