Archive: File copy error message


File copy error message
Hello,

I've got a C# application that's running in the systray. When the installer goes to update the program with the latest version, I get an error on the exe file since it is currently in use:

Error opening file for writing:
Click abort, retry, ignore, etc.

Is there a way to change that error message so I can alert the user to shut down the application before trying again?

I've tried to force the application to close using the FindWindow methods I've seen in the forums, but I cannot find the title or class name of the application. I'm not sure if this is because it's in the systray or if it's something to do with C#. Ideally I'd terminate the application before installing, but without that, the only method I've found is to kill the whole process (which I can get via the filename). Killing it like that, however, is messy and I'd rather not do that.

So basically, can that error message be changed?

Thanks,
Frij


I guess you could try opening the file for writing and then check the error flag.

ClearErrors
FileOpen $R0 "$INSTDIR\file.exe" w
IfErrors locked not_locked

-Stu


Or you can use SetOverwrite try and check the error flag, which is how the Library macros handle this situation.