杉宫竹苑工作室

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

NSIS 实现注册表记录组件是否已选

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

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

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

x

  1. !include "MUI2.nsh"
  2. !insertmacro MUI_PAGE_COMPONENTS
  3. !insertmacro MUI_PAGE_INSTFILES
  4. !insertmacro MUI_LANGUAGE "SimpChinese"

  5. Name "注册表记录组件是否已选"
  6. OutFile "注册表记录组件是否已选.exe"
  7. InstallDir "$TEMP"

  8. Section /o "快捷方式" SEC01
  9.   WriteRegStr HKCU "dome" "Desktop" "yes"
  10. SectionEnd

  11. Section /o "开始菜单" SEC02
  12.   WriteRegStr HKCU "dome" "Start Menu" "yes"
  13. SectionEnd

  14. Function .onInit
  15.   ReadRegStr $R1 HKCU "dome" "Desktop"
  16.   ${If} $R1 != ""
  17.                 SectionGetFlags ${SEC01} $R0
  18.                 IntOp $0 $R0 | ${SF_SELECTED}
  19.                 SectionSetFlags ${SEC01} $0
  20.   ${EndIf}

  21.   ReadRegStr $R2 HKCU "dome" "Start Menu"
  22.   ${If} $R2 != ""
  23.                 SectionGetFlags ${SEC02} $R0
  24.                 IntOp $0 $R0 | ${SF_SELECTED}
  25.                 SectionSetFlags ${SEC02} $0
  26.   ${EndIf}
  27.   DeleteRegKey HKCU "dome"  ;这里为什么要删除呢?因为我只需要记录上次安装的组件选择情况,否则,这一句删除即可。
  28. FunctionEnd
复制代码


回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-15 02:42 , Processed in 0.115671 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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