NSIS 自定义结束页面范例

NSIS 自定义结束页面范例


#############################################
#自定义结束页面
#脚本编写:水晶石
#原文转载注明出处
#############################################
!include "MUI2.nsh"
var Label
#############################################
Name "Modern UI Test"
OutFile "WelcomeFinish.exe"
RequestExecutionLevel user
InstallDir "$temp"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
#插入自定义页面
Page custom FinishPage FinishPage_LEAVE
##############################################
!insertmacro MUI_LANGUAGE "SimpChinese"
##############################################
Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
SectionEnd
LangString DESC_SecDummy ${LANG_ENGLISH} "测试"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
##############################################

!macro DestroyWindow HWND IDC
GetDlgItem $R0 ${HWND} ${IDC}
System::Call 'user32::DestroyWindow(iR0)'
!macroend
##############################################
Function FinishPage
!insertmacro DestroyWindow $HWNDPARENT 1028
!insertmacro DestroyWindow $HWNDPARENT 1256
nsDialogs::Create 1044
Pop $0
${If} $0 == error
Abort
${EndIf}
SetCtlColors $0 "" "0XFFFFFF"

${NSD_CreateBitmap} 0 0 100% 100% ""
Pop $1
${NSD_SetImage} $1 "$PLUGINSDIR\modern-wizard.bmp" $0
${NSD_CreateLabel} 181 20 280 40 "安装完成"
Pop $9
ShowWindow $9 ${SW_HIDE}
SetCtlColors $9 "" transparent
ShowWindow $9 ${SW_SHOW}
CreateFont $2 "tahoma" "10" "800"
SendMessage $9 ${WM_SETFONT} $2 0

${NSD_CreateLabel} 181 60 280 50 "安装完成安装完成安装完成安装完成"
Pop $Label
ShowWindow $Label ${SW_HIDE}
SetCtlColors $Label "" transparent
ShowWindow $Label ${SW_SHOW}
${NSD_CreateCheckbox} 181 70u 79u 9u "访问NSISFANS.COM"
Pop $4
ShowWindow $4 ${SW_HIDE}
SetCtlColors $4 "" 0xffffff
ShowWindow $4 ${SW_SHOW}
${NSD_Check} $4
${NSD_CreateCheckbox} 181 85u 79u 9u "运行nsis"
Pop $6
ShowWindow $6 ${SW_HIDE}
SetCtlColors $6 "" 0xffffff
ShowWindow $6 ${SW_SHOW}
${NSD_Check} $6
${NSD_CreateCheckbox} 181 100u 79u 9u "设置主页"
Pop $5
ShowWindow $5 ${SW_HIDE}
SetCtlColors $5 "" 0xffffff
ShowWindow $5 ${SW_SHOW}
${NSD_Check} $5
nsDialogs::Show
FunctionEnd

################################################################################

Function FinishPage_LEAVE
#此处放置获取和判断勾选框状态代码,然后根据复选框状态运行相关指定动作#
#仅写一例,其余类同
${NSD_GetState} $4 $7
${if} $7 = ${BST_CHECKED}
ExecShell "open" "http://www.nsisfans.com"
${EndIf}
FunctionEnd
posted @ 2017-05-09 20:53  汉学  阅读(1038)  评论(0编辑  收藏  举报