Archive: change cancel button text if setup fails


change cancel button text if setup fails
  I would like to change the cancel button text if my setup fails at the MUI_PAGE_INSTFILES. I tried


Section "A"
/* ... setup stuff ... */
GetDlgItem $4 $HWNDPARENT 2 /* 1 = Next, 2 = Cancel, 3 = Back */
${If} $0 != ''
/*Error*/
IfSilent +3
MessageBox MB_OK|MB_ICONSTOP "Installation failed"
SendMessage $4 ${WM_SETTEXT} "0" "Close"
Abort 'Error message'
${EndIf}
SectionEnd

but it does not work. How can I do it?

thanks
een

You are using WM_SETTEXT wrong. try this:

SendMessage$4 ${WM_SETTEXT} "STR:Close" "STR:Close" 


Thanks but this did not help. Here is my complete Script:

!include "MUI2.nsh"

>!define MUI_ABORTWARNING

>!insertmacro MUI_PAGE_INSTFILES
>!insertmacro MUI_PAGE_FINISH
>!insertmacro MUI_LANGUAGE "English"

>Name "NoName"
>OutFile "Setup.exe"
>InstallDir "$EXEDIR"

>Section "A"
GetDlgItem $4 $HWNDPARENT 2 /* 1 = Next, 2 = Cancel, 3 = Back */
SendMessage $4 ${WM_SETTEXT} "STR:Close" "STR:Close"
MessageBox MB_OK|MB_ICONSTOP "Installation failed"
/* SendMessage $4 ${WM_SETTEXT} "STR:Close" "STR:Close" */
Abort 'Error message'
/* SendMessage $4 ${WM_SETTEXT} "STR:Close" "STR:Close" */
>SectionEnd
>
While the message box is active I can see a gray "Close" button at the main window. But as soon as I close the message box the button text goes back to "cancel". I also tried the SendMessage comand at the uncommented positions but it did not solve the problem.

I am using NSIS v2.46 advanced logging build.

At this moment it is impossible to do...
Installer really needs the .onAbort callback!!!

The problem is that some call overwrite the text on Cancel button after I change it...
Only way to change it is to copy your text into cancel button variable:


StrCpy $(^CancelBtn) "Close" 

but this is not allowed from code...

You can use MiscButtonText and use a variable for the Cancel button text with its initial value set to $(^CancelBtn).

Stu