最新消息:

自定义界面的几种用法

nsis 永恒心锁 1930浏览 0评论
!define APP_NAME 'Test'
name ${APP_NAME}
outfile '${APP_NAME}.exe'
showinstdetails show
InstallDir '$PROGRAMFILES${APP_NAME}'
!include 'mui.nsh'
!define MUI_PAGE_CUSTOMFUNCTION_PRE wel_pre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW wel_show
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW lic_show
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE lic_leave
!insertmacro MUI_PAGE_LICENSE '${NSISDIR}DocsModern UILicense.txt'
!define MUI_PAGE_CUSTOMFUNCTION_PRE dir_pre
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE dir_leave
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE comp_pre
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "SimpChinese"
Function wel_pre
 strcmp '$0' '1' noabort
 messagebox mb_yesno|mb_defbutton2|mb_iconquestion "跳过安装界面?" idno noabort
 strcpy $0 2
 abort
 noabort:
 strcpy $0 1
Functionend
Function wel_show
 FindWindow $1 "#32770" "" $HWNDPARENT
 SetCtlColors $1 '' '0x000000'
 GetDlgItem $2 $1 1201
 SetCtlColors $2 '0x00FF00' '0x000000'
 GetDlgItem $2 $1 1202
 SetCtlColors $2 '0xFFFF00' '0x000000'
 CreateFont $1 "$(^Font)" "10" ""
 SendMessage $2 ${WM_SETFONT} $1 0
FunctionEnd
Function lic_show
 StrCmp $R1 '0' btncheck
 FindWindow $1 "#32770" "" $HWNDPARENT
 GetDlgItem $1 $1 1000
 CreateFont $2 "Comic Sans MS" "10" "700"
 SendMessage $1 ${WM_SETFONT} $2 0
 btncheck:
 strcmp '$0' '2' 0 end
 GetDlgItem $1 $HWNDPARENT 3
 EnableWindow $1 0
 end:
Functionend
Function lic_leave
 intcmp '$R1' '1' next 0 next
 ShowWindow $HWNDPARENT "${SW_HIDE}"
 messagebox mb_ok|mb_iconexclamation '您已按过我同意按钮,是吗?
 那么,你必须按它再一次!'
 FindWindow $1 "#32770" "" $HWNDPARENT
 GetDlgItem $1 $1 1000
 CreateFont $2 "$(^Font)" "8" "700"
 SendMessage $1 ${WM_SETFONT} $2 0
 IntOp $R1 $R1 + 1
 ShowWindow $HWNDPARENT "${SW_RESTORE}"
 abort
 next:
 strcmp $R1 '2' end
 messagebox mb_ok|mb_iconinformation '好吧,提前进入'
 end:
 call read_red
Functionend
Function read_red
 strcmp $R1 '2' end
 ShowWindow $HWNDPARENT "${SW_HIDE}"
 IntOp $R1 $R1 + 1
 messagebox mb_ok|mb_iconstop "要看过才能继续,继续看"
 GetDlgItem $1 $HWNDPARENT 1037
 CreateFont $2 "$(^Font)" "10" "700"
 SendMessage $1 ${WM_SETFONT} $2 0
 SetCtlColors $1 '0xFF0000' '0xFFFFFF'
 GetDlgItem $1 $HWNDPARENT 1038
 CreateFont $2 "Tahoma" "9" ""
 SendMessage $1 ${WM_SETFONT} $2 0
 SetCtlColors $1 '0xFF0000' '0xFFFFFF'
 ShowWindow $HWNDPARENT "${SW_RESTORE}"
 SendMessage $HWNDPARENT "0x408" "0" "0"
 Abort
 end:
FunctionEnd
Function dir_pre
 GetDlgItem $1 $HWNDPARENT 1037
 CreateFont $2 "$(^Font)" "8" "700"
 SendMessage $1 ${WM_SETFONT} $2 0
 SetCtlColors $1 '0x000000' '0xFFFFFF'
 GetDlgItem $1 $HWNDPARENT 1038
 CreateFont $2 "$(^Font)" "8" ""
 SendMessage $1 ${WM_SETFONT} $2 0
 SetCtlColors $1 '0x000000' '0xFFFFFF'
Functionend
Function dir_leave
 ShowWindow $HWNDPARENT "${SW_HIDE}"
 messagebox mb_yesno|mb_iconquestion "跳过组件?" idno end
 push 'skip components'
 end:
Functionend
Function comp_pre
 pop $R0
 StrCmp '$R0' 'skip components' 0 end
 messagebox mb_ok|mb_iconinformation '您选择跳过组件!'
 ShowWindow $HWNDPARENT "${SW_RESTORE}"
 abort
 end:
 ShowWindow $HWNDPARENT "${SW_RESTORE}"
Functionend
Function .onInit
 StrCpy $0 0
 StrCpy $R1 0
FunctionEnd
Section 'boo'
 sleep 5000
Sectionend
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 自定义界面的几种用法

您必须 登录 才能发表评论!