我认为标题栏关闭按钮不关心其他按钮是否隐藏,但它确实关心您是否在 InstFiles 页面上以及是否在最后一页等。
您可以使用ChangeUI属性更改 UI 布局。您也可以在运行时执行此操作:
Outfile "setup.exe"
Name "Wannabe UI"
Caption "$(^Name)"
RequestExecutionLevel user
XPStyle off
AutoCloseWindow true
!include nsDialogs.nsh
!include WinMessages.nsh
!include LogicLib.nsh
!define PBM_SETBARCOLOR 0x409
!define PBM_SETBKCOLOR 0x2001
!define CLRTXT ffffff
!define CLRBKG 353535
Page Custom mypagecreate
Page InstFiles
!macro SetPixelSize w h
System::Call 'USER32::SetWindowPos(i$hwndparent,i0,i0,i0,i${w},i${h},i0x1a)'
GetDlgItem $0 $hwndparent 0x3fa
System::Call 'USER32::SetWindowPos(i$0,i0,i0,i0,i${w},i${h},i0x10)'
!macroend
!macro DisableWindowClose disable
System::Call 'USER32::GetSystemMenu(i$hwndparent,i0)i.r0'
System::Call 'USER32::EnableMenuItem(ir0,i0xF060,i${disable})'
!macroend
var progbar
var progtxt
var button
Function mypagecreate
!insertmacro DisableWindowClose 1
!insertmacro SetPixelSize 400 200
SetCtlColors $hwndparent 0x${CLRTXT} 0x${CLRBKG}
GetDlgItem $1 $hwndparent 1
ShowWindow $1 0
GetDlgItem $1 $hwndparent 2
ShowWindow $1 0
GetDlgItem $1 $hwndparent 0x404
ShowWindow $1 0
nsDialogs::Create 1018
Pop $0
${NSD_CreateLabel} 5% 13u 100% 10u "Some text here?"
Pop $0
SetCtlColors $0 0x${CLRTXT} 0x${CLRBKG}
${NSD_CreateProgressBar} 5% 25u 83% 10u ""
Pop $progbar
${NSD_AddStyle} $progbar 1 ;PBS_SMOOTH
SendMessage $progbar ${PBM_SETBARCOLOR} 0 0xee8888
SendMessage $progbar ${PBM_SETBKCOLOR} 0 0x${CLRBKG}
${NSD_CreateLabel} -27u 25u 19u 10u ""
Pop $progtxt
SetCtlColors $progtxt 0x${CLRTXT} 0x${CLRBKG}
${NSD_CreateButton} -60u -35u 50u 12u "&Close"
Pop $button
ShowWindow $button 0
; NSIS cannot color a button, you have to use a plugin to do it,
; or you could use a image...
;SetCtlColors $button 0x${CLRTXT} 0x${CLRBKG}
${NSD_OnClick} $button done
FindWindow $0 "#32770" "" $hwndparent ; Find inner dialog
SetCtlColors $0 0x${CLRTXT} 0x${CLRBKG}
${NSD_CreateTimer} emulatework 300
nsDialogs::Show
FunctionEnd
Function emulatework
SendMessage $progbar ${PBM_GETPOS} 0 0 $0
IntOp $0 $0 + 3
${If} $0 >= 100
${NSD_KillTimer} emulatework
!insertmacro DisableWindowClose 0
ShowWindow $button 1
StrCpy $0 100
${EndIf}
SendMessage $progbar ${PBM_SETPOS} $0 0
${NSD_SetText} $progtxt "$0%"
FunctionEnd
Function done
SendMessage $hwndparent ${WM_CLOSE} 0 0
FunctionEnd
Section
SectionEnd
您必须使用插件来下载文件,也许InetBgDL非常适合这种类型的 UI...