Nsis打包unity window exe程序(使用现代UI)

引入现代UI头文件

!include "MUI2.nsh"

页面设置

 #安装时取消 弹出确认框
 !define MUI_ABORTWARNING
 #安装时欢迎界面的图片
 !define MUI_WELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp  
 #卸载时欢迎界面的图片
 !define MUI_UNWELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp

安装页面

  #欢迎界面
  !insertmacro MUI_PAGE_WELCOME 
  #设置安装目录界面
  !insertmacro MUI_PAGE_DIRECTORY
  #安装
  !insertmacro MUI_PAGE_INSTFILES
  #安装完成
  !insertmacro MUI_PAGE_FINISH

卸载页面

#欢迎界面
!insertmacro MUI_UNPAGE_WELCOME
#确认界面
!insertmacro MUI_UNPAGE_CONFIRM
#卸载
!insertmacro MUI_UNPAGE_INSTFILES
#卸载完成
!insertmacro MUI_UNPAGE_FINISH

设置页面语言

!insertmacro MUI_LANGUAGE "SimpChinese"

控制面板显示程序信息

#显示名称
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UGUI" "DisplayName" "UGUI"
#设置卸载路径
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UGUI" "UninstallString" "$INSTDIR\Uninstall.exe"
#删除信息
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UGUI"

资料

Modern UI 2.1

示例

!include "MUI2.nsh"
Unicode true
Name "Guide"
OutFile "Basic.exe"
InstallDir $Desktop\ModernUITest
 
  !define MUI_ABORTWARNING
  !define MUI_WELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp
  !define MUI_UNWELCOMEFINISHPAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp

  !insertmacro MUI_PAGE_WELCOME
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  !insertmacro MUI_PAGE_FINISH

 
  !insertmacro MUI_UNPAGE_WELCOME
  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES
  !insertmacro MUI_UNPAGE_FINISH

  !insertmacro MUI_LANGUAGE "SimpChinese"

Section
    SetOutPath $INSTDIR
    File *.exe
    File *.dll
    File /r MonoBleedingEdge
    File /r UGUI_Data
    WriteUninstaller $INSTDIR\Uninstall.exe
    CreateDirectory "$SMPROGRAMS\A Test"
    CreateShortcut "$DESKTOP\UGUI.lnk" "$INSTDIR\UGUI.exe"
    CreateShortcut "$SMPROGRAMS\A Test\UGUI.lnk" "$INSTDIR\UGUI.exe"
    CreateShortcut "$SMPROGRAMS\A Test\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UGUI" "DisplayName" "UGUI"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UGUI" "UninstallString" "$INSTDIR\Uninstall.exe"
SectionEnd

Section "Uninstall"
    RMDIR /r $INSTDIR 
    RMDIR /r "$SMPROGRAMS\A Test"
    Delete "$DESKTOP\UGUI.lnk"
    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\UGUI"
SectionEnd
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值