Archive: Hide Back Button


Hide Back Button
Hi,

I'm trying to hide the back button when the installer is running for the 2nd time on the same system (I called it upgrade mode), on the component selection page. I successfuly disable the welcome, dir, startmenu pages so far.

What I'm trying to do is when user runs setup 2nd time, then disable all the pages except the component page, install page and finish page.

Here is how I'm doing this:


; Welcome page
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckPrev
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckPrev
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "E:\MyApp\license.txt"
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckPrev
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "MyApp"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckPrev
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Readme.txt"
!insertmacro MUI_PAGE_FINISH

var IsUpgrade

; Check if new installation or upgrade...
Function .onInit
StrCpy $IsUpgrade "0"
ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
StrCmp $R0 "" NewInstallation
MessageBox MB_ICONQUESTION|MB_YESNO \
"$(^Name) is already present on the system: \
$\r$\nYou must update it. You cannot install it in a different folder.$\r$\n \
$\r$\nDo you want to continue the installation ?" IDYES +2
Abort
StrCpy $IsUpgrade "1"
ReadRegStr $ICONS_GROUP ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}"

NewInstallation:
FunctionEnd

; Skip the Welcome, Dir, StartMenu page(s) if upgrade...
Function CheckPrev
StrCmp $IsUpgrade "1" "" +2
Abort
FunctionEnd


-- This is working great for correctly showing the pages of interest. But I would like to hide the "Back" button at component page also in "upgrade mode".

Please help...
Thanks,

Okay, found it.


Hi,
so I want to disable the back button too.
could you explain me how did you do please?
thanks.


It's cool I found a solution for hide buttons


FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $1 $HWNDPARENT 3 ; bouton précédent
ShowWindow $1 ${SW_HIDE}


I simply select the window and after the button with "GetDlgItem "" "" 3". number 3 is for back button, 1 and 2 are for the two others button.
I'm showing the window with hidding the button selected.
To show the button again it's the same code with "HIDE" who become "NORMAL" .

When using ${SW_HIDE} or ${SW_SHOW} don't forget to '!include WinMessages.nsh' before using them.

Check also this topic.
http://forums.winamp.com/showthread.php?threadid=216400


oh yes I've fogot the inclusion.
in fact if you include MUI.nsh you don't need to include WinMessages.nsh.


Page Custom IOpage "" IOshow
Page InstFiles

Function IOpage
InstallOptions::dialog "$PLUGINSDIR\io.ini"
FunctionEnd

Function IOshow
GetDlgItem $0 $HWNDPARENT 3
ShowWindow $0 0
FunctionEnd

just wondering why this doesn't hide the "back" button on my io-page (do i really need two functions for this?)

If you look at Page Custom in the manual, you'll see that you can't have a SHOW function.
You should put:
GetDlgItem $0 $HWNDPARENT 3
ShowWindow $0 0
Above the InstallOptions call.

With your current code, you're giving your custom page a caption of "IOshow"!

-Stu