Archive: Aborting from a function inside MUI_APGECUSTOMEFUNCION_LEAVE


Aborting from a function inside MUI_APGECUSTOMEFUNCION_LEAVE
Hi,

I have a problem with aborting the installer from a custom function when I am leaving from the Directory page in the installer.

Basically my requirement is to quit the installer if the directory doesn't have minimum size required. I am able to get into the error condition then I display new MessageBox saying "you didnt meet requirements" and then do an ABORT. But, this abort is quitting only the messageBox not the actual Installer window. Do I need to get handle from this custom function or something?

Any help is much appreciated. Following is the code snippet.

....
....
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE dir_leave
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!insertmacro MUI_PAGE_DIRECTORY
...
...
;This Function will be called on leaving of Dir Page
;This will chekc the install director is proper or not
;If installation directory is not correct this will stop the
;installation on the directory page so that user can change the
;installation directory
Function dir_leave

getInstDirError $0
${Switch} $0
${Case} 0
${Break}
${Case} 1
MessageBox MB_OK "You do not meet req"
abort
${Break}
${Case} 2
MessageBox MB_OK|MB_ICONSTOP "You do not meet req"
abort
${Break}
${EndSwitch}

FunctionEnd


Use Quit instead of Abort. In the leave function, Abort tells the installer to stay in that page and not to abort the installer.

However, it is recommended that you keep it this way. Quitting the installer just because the user selected a directory with not enough space seems harsh and unpleasant for the user.