我想使用NSIS创建一个Web下载安装程序。我从安装flash中捕获了以下屏幕截图,这正是我想创建自己的安装程序,它也下载了一些文件然后执行。
我已经尝试过NSIS现代UI以及nsDialogs,但我发现我很难自定义上面的页面。我在这里遇到的问题是,
作为NSIS初学者,我非常感谢您的帮助/建议/指导。 提前谢谢,
答案 0 :(得分:3)
我认为标题栏关闭按钮不关心其他按钮是否被隐藏,但是如果您已经在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 ...
答案 1 :(得分:0)
(1)最好使用resource editor,但我认为nsis有一个plugin让你在运行时这样做
(2-4)有几个插件可以改变安装程序的外观。请查看skinned control,skin-crafter或skinned button
(5)使用.onInstFailed函数