Archive: MUI_PAGE_CUSTOMFUNCTION on Windows Vista


MUI_PAGE_CUSTOMFUNCTION on Windows Vista
  Hi all,
I've created an installer which has a custom function call upon leaving a page in the installation progress.
This is to check if the chosen directory exists already and/or is empty.

This works fine on Windows XP, but on Vista the function is called and executed, but then the installation does not continue. Without this custom function the installation does work on Vista, too.

Here is my code:


insertmacro MUI_PAGE_WELCOME

>!define MUI_PAGE_CUSTOMFUNCTION_LEAVE "DirectoryLeave"
>!insertmacro MUI_PAGE_DIRECTORY
>!insertmacro MUI_PAGE_INSTFILES
>!insertmacro MUI_PAGE_FINISH

>***91;...***93;

Function DirectoryLeave

${DirState} "$INSTDIR" $R0
StrCmp $R0 1 0+2
MessageBox MB_OKCANCEL
|MB_ICONQUESTION "Installation directory $INSTDIR is not empty. Setup will delete all existing files.$\n$\nPress OK to continue anyway, or press CANCEL to choose another directory." IDOK _ok
Abort

_ok:
Delete "$INSTDIR\*.*"

>FunctionEnd
>
Any help would be appreciated.

+2 skips to the next instruction which is Abort. Abort causes the user to stay on the page. I don't see how that'd work even on XP. Use the LogicLib for easier code.

${If} $Ro == 1
MessageBox MB_OK blah
Abort
${Else}
Delete ...
${EndIf}

Hi,
thanks for your help. It seems I had a logical error in my script. ;)

Also the LogicLib did help me a lot. So, thanks again.