Skip to content

Callbacks

alexmitev81 edited this page Feb 28, 2018 · 5 revisions

Standard Callbacks

Like all other regular NSIS pages, both the MULTIUSER_PAGE_INSTALLMODE and MULTIUSER_UNPAGE_INSTALLMODE pages support the standart PRE, SHOW, LEAVE callbacks (you can use the same code also when not using any of the MUI libraries):

!define MUI_PAGE_CUSTOMFUNCTION_PRE PageInstallModePre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW PageInstallModeShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE PageInstallModeLeave
!insertmacro MULTIUSER_PAGE_INSTALLMODE
...
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.PageInstallModePre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.PageInstallModeShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.PageInstallModeLeave
!insertmacro MULTIUSER_UNPAGE_INSTALLMODE

NsisMultiUser Callbacks

MULTIUSER_INSTALLMODE_CHANGE_MODE_FUNCTION

Provide a callback function when the current install mode changes. It is called when the user toggles between per-machine and per-user installation, but also when the script is initialized, i.e. when the installer/uninstaler starts. It is guaranteed to be called at least once when the installer/uninstaler starts. It is also called when the inner instance starts.

This callback can be used both for the installer and uninstaller page. Usually you'll want to use this callback to set the $StartMenuFolder variable in it.

Usage:

!define MULTIUSER_INSTALLMODE_CHANGE_MODE_FUNCTION PageInstallModeChangeMode
!insertmacro MULTIUSER_PAGE_INSTALLMODE 
...
!define MULTIUSER_INSTALLMODE_CHANGE_MODE_FUNCTION PageInstallModeChangeMode
!insertmacro MULTIUSER_UNPAGE_INSTALLMODE 
...
Function PageInstallModeChangeMode
	!insertmacro MUI_STARTMENU_GETFOLDER "" $StartMenuFolder
FunctionEnd

MULTIUSER_INSTALLMODE_CHANGE_MODE_UNFUNCTION

Same as MULTIUSER_INSTALLMODE_CHANGE_MODE_FUNCTION, but for the uninstaller.

This callback is still supported in old code, but in new code you should use MULTIUSER_INSTALLMODE_CHANGE_MODE_FUNCTION instead.

MULTIUSER_INSTALLMODE_FUNCTION

This callback is still supported in old code, but in new code you should use MULTIUSER_INSTALLMODE_CHANGE_MODE_FUNCTION instead.

MULTIUSER_INSTALLMODE_UNFUNCTION

This callback is still supported in old code, but in new code you should use MULTIUSER_INSTALLMODE_CHANGE_MODE_UNFUNCTION instead.