Archive: Cancelling the installation process as it happens


Cancelling the installation process as it happens
Hello,

I am trying to make an installer for a large program and I have sucessfully done so using NSIS and using the ModernUI, but there is one thing I want to be able to add, but it doesn't seem to be an option. What I want to do is to make it so that users of my installer can cancel the install while it is happening in the install screen, so that if the install is taking too long or users realise that they have made a mistake or whatever, they can stop the install as it happens by pressing cancel, at which point the installer will remove all of the files that it had put onto the computer. It's quite surprising to me that this does not seem to be a supported feature in the ModernUI, and it makes me think that I am just missing something obvious, but I have tried and looked through the documentation and forums to no avail. I know that the UltraModernUI allows this, but there are problems with that itself anyway, and it is not what we want to use if we can help it.

Thanks in advance for any help,

Hayden Devlin


Have you tried using the callback function .onUserAbort. Just write the files you want to remove when the user aborts the installer, you can have the installer do anything over here. This is the flexibility of NSIS over other Installers.;)


Well when installing the cancel button is not enabled, it is shaded out so you can't press it. Surely the onAbort method would only be called when cancel is clicked yes? Do you know how to enable the cancel button while installing?

Thanks,

Hayden Devlin


I am not sure but try defining this at the top of your script

!define MUI_FINISHPAGE_ABORTWARNINGCHECK


I'm afraid that doens't seem to do anything :( When the installation occurs all buttons become disabled, including the buttons of the window itself (except for the minimize button). Does that happen for other people when their software installs or have I somehow set that myself? What I want is just to have ht ecancel button enabled while uninstalling

Thanks,

Hayden Devlin


This link might help you.

http://sourceforge.net/tracker/index...49&atid=373087


Oh great that looks like it might be able to do what I am after I will have a look tomorrow to make sure but it sounds good!

Thanks,

Hayden Devlin


Hmm don't want to sound too stupid but how do you use what is on that website? There are 2 .patch files you can download, but aren't .patch they for unix? If not does anyone know how to use them on a windows machine?

Thanks,

Hayden Devlin


I have managed to install the patches onto my windows version of NSIS 2.30 by using cygwin (like a unix environment for windows) to do the patching via the unix patch command. The patch, however seems to only work on an older version of NSIS, as some of the code regions for patching are now slightly different from when the patch was written. This means that not all of the patch sections or 'hunks' work, and the patched version no longer compiles. By reading the patch file and manually applying the patch sections to the current NSIS code I managed to apply all of the patch code. This did not compile because of a more recently added line of code in the NSIS code, but with a little tinkering it compiled ok, but then crashes when you run it. So basically the patch doesn't work anymore. Does anyone know if there is an up-to-date patch for this, or what version of NSIS the patch actually works with (and where I can get it)?

Thanks in advance for any help,

Hayden Devlin


If you attach your latest changes, I can have a look and see why it crashes.


I've found the problem, it lies here:
ui.c ( line 676 )


else if (id == IDCANCEL)
{
...
...
...
if (g_this_page->wndproc_id == PWP_INSTFILES)
{

}


g_this_page is NULL, when CANCEL button is pressed during setup of installation process ( dest. folder, shortcuts etc. )

Currently I'm trying to solve this problem.

Hi there

What is the current status ? Is it still impossible to cancel installation (abort installation while it is installing) ?

The previous patch seems out of date for current NSIS builds.

As "aborting" is already possible when the user is prompted the dialog for a file that cannot be open for writing, it shouldn't be too hard to implement the Cancel button to behave as if user clicked abort on that dialog.
(of course this would allow aborting only during "File" operations, but this would be enough for most installers)


Status hasn't changed.

Abortion isn't the same as the file open problem dialog. Those originate from two different threads. The naive implementation would actually only make it possible to abort in between File commands and not while extracting a big file.


sure..

I was just saying that rather than waiting 6+ months for a new "abort" feature fully implemented, that could be nice to start by having a quick implementation that would be already enough to answer the needs of 90% of NSIS users.

(if the demand is strong)


I currently have more important subjects lined up. A high quality and up-to-date patch would be useful.


So far I have had no luck enabling the cancel button during the install section, so is it possible to remove it. I have been working on a single page install (for a patch) and since this is the only page the back and cancel buttons are pointless/redundant. Short of defining my own custom page, is there a way to remove these butttons?


Hi All
Have run into the same problem recently. Managed to enable "cancel", but have no luck to stop file copying thread. and therefore removing files in .onGuiEnd leads to crash or leftover files.
Already read similar threads, nothing helpfull found.
Is there is a way to add a command to stop file copying process? or add a mutex, which should be checked before copying every next file, so we can at least wait while an operation on sigle file finished?
Advice is highly appreciated.

Regards, Dmut

ps: kichik, NSIS is THE BEST, don't stop on it :)


Is there still no workaround for this with MUI? I have a large (~2GB) installer and it would be nice to allow aborting it, even without any kind of rollback.


Originally posted by coderanger
Is there still no workaround for this with MUI? I have a large (~2GB) installer and it would be nice to allow aborting it, even without any kind of rollback.
I have had to use nsis.sourceforge.net/Multi-volume_Distribution "CABsetup", to implement a canceling, rollback, and to be able to create my installer bigger then 2gb.

Originally posted by dmut
I have had to use nsis.sourceforge.net/Multi-volume_Distribution "CABsetup", to implement a canceling, rollback, and to be able to create my installer bigger then 2gb.
Can you cancel the running install process?