hooklee
25th May 2005 15:57 UTC
Problem with CopyFiles: "Cancel" cannot be detected
ClearErrors
CopyFiles C:\dir1\*.* C:\dir2
IfErrors 0 +2
MessageBox MB_OK "Error or cancelled!"
Running the above code with a large numer of files (about 600MB in my test), NSIS cannot catch the event if the user clicks "Cancel" button quickly after the copying dialog appears. If the user clicks the "Cancel" button after a few minutes, NSIS can successfully catch the event and popup the message box.
The problem seems related to the not-very-short preparation stage of the long copying operation. Is it a bug of NSIS or Windows? Any solution?
scully13
25th May 2005 18:38 UTC
Some of the installers I wrote also use similar logic to detect if somebody hit the Cancel button. I rarely copy more than a few files at a time though so I couldn't reproduce the bug with my real scripts. I did however change my script to copy a large folder with lots of files (i.e. c:\windows) and then I could reproduce the error every time. I don't have any suggestions for you but just wanted to let you know that the preparation stage is most likely the culprit like you said. If only there was a way to hide or disable the Cancel button. I also wish you could alter the text that displays during the Windows copy dialog.
hooklee
25th May 2005 18:50 UTC
Currently, I have to detect this by checking a marker file. It works well for my installer.