Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 10th October 2008, 14:21   #1
dev123
Junior Member
 
Join Date: Oct 2008
Posts: 1
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
dev123 is offline   Reply With Quote
Old 7th November 2008, 20:46   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump