I used the nsWindows.dll plug-in, but some malfunctions I can not fix, and whoever knows better can fix the problems.
1. Move the popup window to the main window
2. Close the popup automatically when you move the mouse to another component
PHP Code:
!define APP "My Setup"
!define INIT
!define COMPONENTS
# DETAILS #
Name "${APP}"
OutFile "${APP}.exe"
InstallDir "$TEMP\${APP}"
Caption "${APP}"
# COMPRESS #
SetCompressor /SOLID /FINAL lzma
# EXEC LEVEL #
RequestExecutionLevel 'User'
# RUNTIME SWITCHES #
ShowInstDetails hide
ShowInstDetails nevershow
ShowUnInstDetails nevershow
AutoCloseWindow true
# INCLUDE #
!include "MUI.nsh"
!include "WinCore.nsh"
!include "nsWindows.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "WinMessages.nsh"
!insertmacro GetOptions
# STYLE #
BrandingText /TRIMRIGHT " "
# PAGE #
!define MUI_CUSTOMFUNCTION_GUIINIT "onGuiInit"
!insertmacro MUI_PAGE_WELCOME
!ifdef OPTIONS | COMPONENTS
!define MUI_COMPONENTSPAGE_NODESC
!define MUI_COMPONENTSPAGE_INTERFACE
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_COMPONENTS
!endif
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
# LANGUAGE #
!insertmacro MUI_LANGUAGE "English"
# INIT #
Function ".onInit"
InitPluginsDir
SetOverwrite try
AllowSkipFiles off
File `/ONAME=$PLUGINSDIR\001.bmp` `Images\001.bmp`
File `/ONAME=$PLUGINSDIR\002.bmp` `Images\002.bmp`
# INIT
!ifdef INIT
Call Init
!endif
FunctionEnd
Function "onGuiInit"
FunctionEnd
var /GLOBAL ERROR
Section "-${APP}" Main
Strcpy $insWindows 0
Strcpy $hnsWindows 0
SetDetailsPrint textonly
DetailPrint `Installing ... Please wait ...`
SetDetailsPrint listonly
SetDetailsView hide
SectionIn RO
CreateDirectory $INSTDIR
SetOutPath "$INSTDIR"
File "Installer.nsi"
Goto +2
StrCpy $ERROR "true"
SetAutoClose true
SectionEnd
!ifdef COMPONENTS
SectionGroup "${APP} Select"
Section /o "${APP} Free" Free
SectionEnd
Section /o "${APP} Professional" Professional
IfFileExists "$INSTDIR\${APP}.exe" "" +4
SetOutPath "$INSTDIR"
;File "Professional\Register.dll"
SectionEnd
SectionGroupEnd
!endif
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton "${Free}"
!insertmacro RadioButton "${Professional}"
!insertmacro EndRadioButtons
FunctionEnd
!ifdef INIT
Function Init
var /GLOBAL REQUIREDSIZE
; === Destroy size lol ===
StrCpy $0 0
${If} ${SectionIsSelected} $0
SectionGetSize $${Main} $1
SectionGetSize $${Free} $1
SectionGetSize $${Professional} $1
IntOp $0 $0 + $1
${EndIf}
InTop $0 $0 * 1024 ; KBytes -> Bytes
IntOp $1 $0 / 1000000
IntOp $2 $0 % 1000000
StrCpy $2 $2 2 0
IntOp $3 $0 / 1048576
IntOp $4 $0 % 1048576
StrCpy $4 $4 2 0
SectionSetSize $${Main} "0" ;use ($1,$2 MB) ;or ($3,$4 MB)
Strcpy $REQUIREDSIZE '$3,$4 MB'
SectionSetSize $${Main} 0
SectionSetSize $${Free} "0"
SectionSetSize $${Professional} "0"
; === Other actions ===
StrCpy $1 ${Free}
FunctionEnd
!endif
Function ShowPictFreeVersion
var /GLOBAL FREE
var /GLOBAL BGImage
nsWindows::Create /NOUNLOAD $HWNDPARENT $${ExStyle} 0x80000000 "" 1018
Pop $FREE
System::Call user32::SetWindowPos(i$FREE,i0,i0,i0,i497,i322,i0x0002)
# Background
nsWindows::CreateControl /NOUNLOAD STATIC 0x10000000|0x40000000|0x04000000|0x0000000E 0 0 0 100% 100% ""
Pop $BGImage
Push $0
Push $R0
StrCpy $R0 $BGImage
System::Call "user32::LoadImage(i 0, ts, i 0, i0, i0, i0x0010) i.r0" "$PLUGINSDIR\001.bmp"
SendMessage $R0 0x0172 0 $0
Pop $R0
Exch $0
nsWindows::Show
FunctionEnd
Function ShowPictProVersion
var /GLOBAL PRO
nsWindows::Create /NOUNLOAD $HWNDPARENT $${ExStyle} 0x80000000 "" 1018
Pop $PRO
System::Call user32::SetWindowPos(i$PRO,i0,i0,i0,i497,i322,i0x0002)
# Background
nsWindows::CreateControl /NOUNLOAD STATIC 0x10000000|0x40000000|0x04000000|0x0000000E 0 0 0 100% 100% ""
Pop $BGImage
Push $0
Push $R0
StrCpy $R0 $BGImage
System::Call "user32::LoadImage(i 0, ts, i 0, i0, i0, i0x0010) i.r0" "$PLUGINSDIR\002.bmp"
SendMessage $R0 0x0172 0 $0
Pop $R0
Exch $0
nsWindows::Show
FunctionEnd
# MOUSE
Function '.onMouseOverSection'
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 1043 ; description item
${If} $0 == -1
CreateFont $1 "Arial" 9 500 ; create the font for the default description
SetCtlColors $R0 0x5f5f61 0xF0F0F0
SendMessage $R0 ${WM_SETFONT} $1 0
EnableWindow $R0 0
SendMessage $R0 ${WM_SETTEXT} 0 "STR:Position your mouse over a component to see its description."
System::Call user32::DestroyWindow(i$FREE)
System::Call user32::DestroyWindow(i$PRO)
${Else}
CreateFont $1 "Arial" 9 400 ; create the font for mouse over descriptions
SetCtlColors $R0 0x5f5f61 0xF0F0F0
SendMessage $R0 ${WM_SETFONT} $1 0
EnableWindow $R0 1
${If} $0 == 0
SendMessage $R0 ${WM_SETTEXT} 0 "STR:Select components for this program"
${ElseIf} $0 == 1
SendMessage $R0 ${WM_SETTEXT} 0 "STR:Select components for this program"
${ElseIf} $0 == 2
System::Call user32::DestroyWindow(i$PRO)
Call ShowPictFreeVersion
SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install ${APP} Free Version"
${ElseIf} $0 == 3
System::Call user32::DestroyWindow(i$FREE)
Call ShowPictProVersion
SendMessage $R0 ${WM_SETTEXT} 0 "STR:Install ${APP} Pro Version"
${ElseIf} $0 == 4
${EndIf}
${EndIf}
FunctionEnd