Sajida_cts
1st August 2005 11:20 UTC
Forcefully Aborting installation
Hi,
I have just shipped my installer for testing. One of the major bugs which came up was that during installation if the installer is forcefully aborted by going to Task Manager->Processes, the installation wont happen again during a subsequent double-click. Which is understandable considering that I'm putting in a registry key check at the beginning of installationa nd taking it off only if the installation succeeds or the user cancels the installation. Is there any way I can handle the forceful abortion of the installation??
I know it is a stupid bug, but please help me out...
Thanks,
Saaji
Afrow UK
1st August 2005 11:48 UTC
I don't think it's possible from the installer side, because when you terminate a program from task manager, you're killing the process, hence the process is no longer running.
What you could do is write another installer which has code in .onInit only (so it's hidden) which has an infinite loop (with say Sleep 5000 in it) which constantly checks if your installer is running (with FindWindow). If it isn't then it changes the registry key and exits (Abort). Obviously you want to compress this into your main installer, and extract it and run it from .onInit too.
Edit: If you don't want the user to run the installer twice (at the same time) you can use a Mutex:
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "my install") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +2
Abort ; abort if another install is running
-Stu