杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1866|回复: 0

自定义界面的用法

[复制链接]
发表于 2017-2-23 21:29:23 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. !define APP_NAME 'Test'
  2. name ${APP_NAME}
  3. outfile '${APP_NAME}.exe'
  4. showinstdetails show
  5. InstallDir '$PROGRAMFILES\${APP_NAME}'

  6. !include 'mui2.nsh'

  7. !define MUI_PAGE_CUSTOMFUNCTION_PRE wel_pre
  8. !define MUI_PAGE_CUSTOMFUNCTION_SHOW wel_show
  9. !insertmacro MUI_PAGE_WELCOME

  10. !define MUI_PAGE_CUSTOMFUNCTION_SHOW lic_show
  11. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE lic_leave
  12. !insertmacro MUI_PAGE_LICENSE '${NSISDIR}\Docs\Modern UI\License.txt'

  13. !define MUI_PAGE_CUSTOMFUNCTION_PRE dir_pre
  14. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE dir_leave
  15. !insertmacro MUI_PAGE_DIRECTORY

  16. !define MUI_PAGE_CUSTOMFUNCTION_PRE comp_pre
  17. !insertmacro MUI_PAGE_COMPONENTS

  18. !insertmacro MUI_PAGE_INSTFILES


  19. !insertmacro MUI_LANGUAGE "SimpChinese"


  20. Function wel_pre
  21.          strcmp '$0' '1' noabort
  22.          messagebox mb_yesno|mb_defbutton2|mb_iconquestion "跳过安装界面?" idno noabort
  23.          strcpy $0 2
  24.          abort
  25.    noabort:
  26.          strcpy $0 1
  27. Functionend


  28. Function wel_show
  29.          FindWindow $1 "#32770" "" $HWNDPARENT
  30.          SetCtlColors $1 '' '0x000000'

  31.          GetDlgItem $2 $1 1201
  32.          SetCtlColors $2 '0x00FF00' '0x000000'

  33.          GetDlgItem $2 $1 1202
  34.          SetCtlColors $2 '0xFFFF00' '0x000000'
  35.          CreateFont $1 "$(^Font)" "10" ""
  36.          SendMessage $2 ${WM_SETFONT} $1 0
  37. FunctionEnd


  38. Function lic_show
  39.          StrCmp $R1 '0' btncheck

  40.          FindWindow $1 "#32770" "" $HWNDPARENT
  41.          GetDlgItem $1 $1 1000
  42.          CreateFont $2 "Comic Sans MS" "10" "700"
  43.          SendMessage $1 ${WM_SETFONT} $2 0

  44.    btncheck:
  45.          strcmp '$0' '2' 0 end
  46.          GetDlgItem $1 $HWNDPARENT 3
  47.          EnableWindow $1 0
  48.    end:
  49. Functionend


  50. Function lic_leave
  51.          intcmp '$R1' '1' next 0 next
  52.          ShowWindow $HWNDPARENT "${SW_HIDE}"
  53.          messagebox mb_ok|mb_iconexclamation '您已按过我同意按钮,是吗? \
  54.          那么,你必须按它再一次!'

  55.          FindWindow $1 "#32770" "" $HWNDPARENT
  56.          GetDlgItem $1 $1 1000
  57.          CreateFont $2 "$(^Font)" "8" "700"
  58.          SendMessage $1 ${WM_SETFONT} $2 0

  59.          IntOp $R1 $R1 + 1
  60.          ShowWindow $HWNDPARENT "${SW_RESTORE}"
  61.          abort
  62.    next:
  63.         strcmp $R1 '2' end
  64.         messagebox mb_ok|mb_iconinformation '好吧,提前进入'
  65.    end:
  66.         call read_red
  67. Functionend


  68. Function read_red
  69.          strcmp $R1 '2' end
  70.          ShowWindow $HWNDPARENT "${SW_HIDE}"
  71.          IntOp $R1 $R1 + 1
  72.          messagebox mb_ok|mb_iconstop "要看过才能继续,继续看"

  73.          GetDlgItem $1 $HWNDPARENT 1037
  74.          CreateFont $2 "$(^Font)" "10" "700"
  75.          SendMessage $1 ${WM_SETFONT} $2 0
  76.          SetCtlColors $1  '0xFF0000' '0xFFFFFF'

  77.          GetDlgItem $1 $HWNDPARENT 1038
  78.          CreateFont $2 "Tahoma" "9" ""
  79.          SendMessage $1 ${WM_SETFONT} $2 0
  80.          SetCtlColors $1  '0xFF0000' '0xFFFFFF'

  81.          ShowWindow $HWNDPARENT "${SW_RESTORE}"
  82.          SendMessage $HWNDPARENT "0x408" "0" "0"
  83.          Abort
  84.    end:
  85. FunctionEnd


  86. Function dir_pre
  87.          GetDlgItem $1 $HWNDPARENT 1037
  88.          CreateFont $2 "$(^Font)" "8" "700"
  89.          SendMessage $1 ${WM_SETFONT} $2 0
  90.          SetCtlColors $1  '0x000000' '0xFFFFFF'

  91.          GetDlgItem $1 $HWNDPARENT 1038
  92.          CreateFont $2 "$(^Font)" "8" ""
  93.          SendMessage $1 ${WM_SETFONT} $2 0
  94.          SetCtlColors $1  '0x000000' '0xFFFFFF'
  95. Functionend


  96. Function dir_leave
  97.          ShowWindow $HWNDPARENT "${SW_HIDE}"
  98.          messagebox mb_yesno|mb_iconquestion "跳过组件?" idno end
  99.          push 'skip components'
  100.    end:
  101. Functionend


  102. Function comp_pre
  103.          pop $R0
  104.          StrCmp '$R0' 'skip components' 0 end
  105.          messagebox mb_ok|mb_iconinformation '您选择跳过组件!'
  106.          ShowWindow $HWNDPARENT "${SW_RESTORE}"
  107.          abort
  108.    end:
  109.          ShowWindow $HWNDPARENT "${SW_RESTORE}"
  110. Functionend


  111. Function .onInit
  112.          StrCpy $0 0
  113.          StrCpy $R1 0
  114. FunctionEnd


  115. Section 'boo'
  116.         sleep 5000
  117. Sectionend
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-5-19 15:32 , Processed in 0.109766 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表