• nsis源码 nsisdialogdesigner


    ; 安装程序初始定义常量
    !define PRODUCT_NAME "nsisdialogdesigner"
    !define PRODUCT_VERSION "1.1.3"
    !define PRODUCT_WEB_SITE "http://www.pythonschool.com"
    !define PRODUCT_UNINST_KEY "SoftwareMicrosoftWindowsCurrentVersionUninstall${PRODUCT_NAME}"
    !define PRODUCT_UNINST_ROOT_KEY "HKLM"

    SetCompressor /SOLID lzma
    SetCompressorDictSize 32

    ; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------
    !include "MUI2.nsh"

    ; MUI 预定义常量
    !define MUI_ABORTWARNING
    !define MUI_ICON "inst.ico"
    !define MUI_UNICON "${NSISDIR}ContribGraphicsIconsmodern-uninstall.ico"

    ; 欢迎页面
    !insertmacro MUI_PAGE_WELCOME
    ; 安装目录选择页面
    !insertmacro MUI_PAGE_DIRECTORY
    ; 安装过程页面
    !insertmacro MUI_PAGE_INSTFILES
    ; 安装完成页面
    !define MUI_FINISHPAGE_RUN "$INSTDIRNSISDialogDesigner.exe"
    !define MUI_FINISHPAGE_SHOWREADME "$INSTDIRHISTORY.txt"
    !insertmacro MUI_PAGE_FINISH

    ; 安装卸载过程页面
    !insertmacro MUI_UNPAGE_INSTFILES

    ; 安装界面包含的语言设置
    !insertmacro MUI_LANGUAGE "SimpChinese"

    ; 安装预释放文件
    #!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
    ; ------ MUI 现代界面定义结束 ------

    Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
    OutFile "nsisdialogdesigner.exe"
    InstallDir "$PROGRAMFILES sisdialogdesigner"
    ShowInstDetails show
    ShowUnInstDetails show
    BrandingText "python丝酷网"

    Section "MainSection" SEC01
    SetOutPath "$INSTDIR"
    SetOverwrite ifnewer
    File /r "nsisdialogdesigner*.*"
    SectionEnd

    Section -AdditionalIcons
    WriteIniStr "$INSTDIR${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
    CreateDirectory "$SMPROGRAMS sisdialogdesigner"
    CreateShortCut "$SMPROGRAMS sisdialogdesignerWebsite.lnk" "$INSTDIR${PRODUCT_NAME}.url"
    CreateShortCut "$SMPROGRAMS sisdialogdesignerUninstall.lnk" "$INSTDIRuninst.exe"
    SectionEnd

    Section -Post
    WriteUninstaller "$INSTDIRuninst.exe"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIRuninst.exe"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
    SectionEnd

    /******************************
    * 以下是安装程序的卸载部分 *
    ******************************/

    Section Uninstall
    Delete "$INSTDIR${PRODUCT_NAME}.url"
    Delete "$INSTDIRuninst.exe"

    Delete "$SMPROGRAMS sisdialogdesignerUninstall.lnk"
    Delete "$SMPROGRAMS sisdialogdesignerWebsite.lnk"

    RMDir "$SMPROGRAMS sisdialogdesigner"

    RMDir "$INSTDIR"

    DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
    SetAutoClose true
    SectionEnd

    #-- 根据 NSIS 脚本编辑规则,所有 Function 区段必须放置在 Section 区段之后编写,以避免安装程序出现未可预知的问题。--#

    Function un.onInit
    MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,及其所有的组件?" IDYES +2
    Abort
    FunctionEnd

    Function un.onUninstSuccess
    HideWindow
    MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
    FunctionEnd

  • 相关阅读:
    sql 执行动态语句
    Cookie/Session机制详解
    .NET简谈事务、分布式事务处理
    .NET(C#)中不同级别的安全透明代码对类型的影响
    C#开发微信门户及应用(1)开始使用微信接口
    WIN7管理工具配置ODBC数据源系统DSN中无Oracle,Sybase驱动的解决方法
    题解 smoj 2806 【建筑物】
    题解 luogu P2568 GCD
    题解 luogu P1251 【餐巾计划问题】
    0377组合总和IV Marathon
  • 原文地址:https://www.cnblogs.com/pythonschool/p/3511903.html
Copyright © 2020-2023  润新知