赞
踩
1.打开一个QT程序,以Release方式编译
2.拷贝.exe文件至新创建一个空文件夹
cd /d D:\qt\QtTestPack
windeployqt testqtCodandMap.exe
3.打包软件
工具:
VNISEdit:VNISEdit下载地址
NSIS安装包制作程序 :NSIS下载地址
4.NSIS:在注册表中记录安装路径以便重装或升级时读取
第1步:读取注册表中关于安装路径的键值,如果没有,就使用默认路径。
第2步:在主区段中把安装路径写入注册表。
第3步:在卸载区段删除注册表中安装路径的键值。
安装包成功安装后,注册表信息中路径的存储截图
附录:
安装包脚本示例:
; 该脚本使用 HM VNISEdit 脚本编辑器向导产生 ; 安装程序初始定义常量 !define PRODUCT_NAME "Lucky application" !define PRODUCT_VERSION "2.2.2.2" !define PRODUCT_PUBLISHER "Lucky My company, Inc." !define PRODUCT_WEB_SITE "http://www.Luckymycompany.com" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\MessageStorage.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" SetCompressor lzma ; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------ !include "MUI.nsh" ; MUI 预定义常量 !define MUI_ABORTWARNING !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" ; 欢迎页面 !insertmacro MUI_PAGE_WELCOME ; 许可协议页面 !insertmacro MUI_PAGE_LICENSE "License.txt" ; 安装目录选择页面 !insertmacro MUI_PAGE_DIRECTORY ; 安装过程页面 !insertmacro MUI_PAGE_INSTFILES ; 安装完成页面 !define MUI_FINISHPAGE_RUN "$INSTDIR\QCreator.exe" !insertmacro MUI_PAGE_FINISH ; 安装卸载过程页面 !insertmacro MUI_UNPAGE_INSTFILES ; 安装界面包含的语言设置 !insertmacro MUI_LANGUAGE "SimpChinese" ; 安装预释放文件 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ; ------ MUI 现代界面定义结束 ------ ; Name设置安装程序的名称 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "Setup.exe" ;常量通常用在 InstallDir 属性里 $PROGRAMFILES:程序文件目录(通常为 C:\Program Files 但是运行时会检测)。 ;默认安装目录 InstallDir "$PROGRAMFILES\Lucky-My application" ;InstallDirRegKey属性让安装程序去检测一注册表里的一个字串,如果该字串可用那么把它用来作为安装目录, ;如果预置了该属性,当指定的注册表键可用时它会越过 InstallDir 指定的字串,否则使用默认的 InstallDir 指定值。 InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" ShowInstDetails show ShowUnInstDetails show Section "MainSection" SEC01 SetOutPath "$INSTDIR\bearer" ;SetOverwrite的属性:on|off|try|ifnewer|ifdiff|lastused SetOverwrite ifnewer File "..\binaries\windows\msvc2015\x86\release\bearer\qgenericbearer.dll" SetOutPath "$INSTDIR" File "..\binaries\windows\msvc2015\x86\release\config.xls" CreateDirectory "$SMPROGRAMS\Lucky-My application" CreateShortCut "$SMPROGRAMS\Lucky-My application\Lucky-My application.lnk" "$INSTDIR\QCreator.exe" CreateShortCut "$DESKTOP\Lucky-My application.lnk" "$INSTDIR\QCreator.exe" File "..\binaries\windows\msvc2015\x86\release\D3Dcompiler_47.dll" File "..\binaries\windows\msvc2015\x86\release\driver.db" File "..\binaries\windows\msvc2015\x86\release\firmware.db" SetOutPath "$INSTDIR\iconengines" File "..\binaries\windows\msvc2015\x86\release\iconengines\qsvgicon.dll" SetOutPath "$INSTDIR\imageformats" File "..\binaries\windows\msvc2015\x86\release\imageformats\qgif.dll" File "..\binaries\windows\msvc2015\x86\release\imageformats\qicns.dll" File "..\binaries\windows\msvc2015\x86\release\imageformats\qico.dll" File "..\binaries\windows\msvc2015\x86\release\imageformats\qjpeg.dll" File "..\binaries\windows\msvc2015\x86\release\imageformats\qsvg.dll" File "..\binaries\windows\msvc2015\x86\release\imageformats\qtga.dll" File "..\binaries\windows\msvc2015\x86\release\imageformats\qtiff.dll" File "..\binaries\windows\msvc2015\x86\release\imageformats\qwbmp.dll" File "..\binaries\windows\msvc2015\x86\release\imageformats\qwebp.dll" SetOutPath "$INSTDIR" File "..\binaries\windows\msvc2015\x86\release\libEGL.dll" File "..\binaries\windows\msvc2015\x86\release\libGLESV2.dll" File "..\binaries\windows\msvc2015\x86\release\map - 副本.xml" File "..\binaries\windows\msvc2015\x86\release\map-1.xml" File "..\binaries\windows\msvc2015\x86\release\map.xml" File "..\binaries\windows\msvc2015\x86\release\MessageStorage.exe" File "..\binaries\windows\msvc2015\x86\release\opengl32sw.dll" SetOutPath "$INSTDIR\platforms" File "..\binaries\windows\msvc2015\x86\release\platforms\qwindows.dll" SetOutPath "$INSTDIR" File "..\binaries\windows\msvc2015\x86\release\plink.exe" SetOutPath "$INSTDIR\plugins" File "..\binaries\windows\msvc2015\x86\release\plugins\DefaultProjectPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\DefaultProjectPlugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\DefaultProjectPlugin.lib" File "..\binaries\windows\msvc2015\x86\release\plugins\demoPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\demoPlugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\demoPlugin.lib" File "..\binaries\windows\msvc2015\x86\release\plugins\FirManageplugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\FirManageplugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\FirManageplugin.lib" File "..\binaries\windows\msvc2015\x86\release\plugins\FtpPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\FtpPlugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\FtpPlugin.lib" File "..\binaries\windows\msvc2015\x86\release\plugins\OutputWidgetPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\OutputWidgetPlugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\OutputWidgetPlugin.lib" File "..\binaries\windows\msvc2015\x86\release\plugins\pluginsBrowserPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\ProcessManagerPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\ProcessManagerPlugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\ProcessManagerPlugin.lib" File "..\binaries\windows\msvc2015\x86\release\plugins\RtdbPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\RtdbPlugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\RtdbPlugin.lib" File "..\binaries\windows\msvc2015\x86\release\plugins\SignInPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\SignInPlugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\SignInPlugin.lib" File "..\binaries\windows\msvc2015\x86\release\plugins\SocketPortPlugin.dll" File "..\binaries\windows\msvc2015\x86\release\plugins\SocketPortPlugin.exp" File "..\binaries\windows\msvc2015\x86\release\plugins\SocketPortPlugin.lib" SetOutPath "$INSTDIR" File "..\binaries\windows\msvc2015\x86\release\pscp.exe" File "..\binaries\windows\msvc2015\x86\release\QCreator.exe" File "..\binaries\windows\msvc2015\x86\release\Qt5Core.dll" File "..\binaries\windows\msvc2015\x86\release\Qt5Gui.dll" File "..\binaries\windows\msvc2015\x86\release\Qt5Network.dll" File "..\binaries\windows\msvc2015\x86\release\Qt5Sql.dll" File "..\binaries\windows\msvc2015\x86\release\Qt5Svg.dll" File "..\binaries\windows\msvc2015\x86\release\Qt5Widgets.dll" File "..\binaries\windows\msvc2015\x86\release\Qt5Xml.dll" File "..\binaries\windows\msvc2015\x86\release\script.db" SetOutPath "$INSTDIR\sqldrivers" File "..\binaries\windows\msvc2015\x86\release\sqldrivers\qsqlite.dll" File "..\binaries\windows\msvc2015\x86\release\sqldrivers\qsqlmysql.dll" File "..\binaries\windows\msvc2015\x86\release\sqldrivers\qsqlodbc.dll" File "..\binaries\windows\msvc2015\x86\release\sqldrivers\qsqlpsql.dll" SetOutPath "$INSTDIR\styles" File "..\binaries\windows\msvc2015\x86\release\styles\qwindowsvistastyle.dll" SetOutPath "$INSTDIR\tools" File "..\binaries\windows\msvc2015\x86\release\tools\SQLManagement1.exe" File "..\binaries\windows\msvc2015\x86\release\tools\xmllist.exe" SetOutPath "$INSTDIR\translations" File "..\binaries\windows\msvc2015\x86\release\translations\qt_ar.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_bg.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_ca.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_cs.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_da.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_de.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_en.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_es.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_fi.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_fr.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_gd.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_he.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_hu.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_it.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_ja.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_ko.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_lv.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_pl.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_ru.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_sk.qm" File "..\binaries\windows\msvc2015\x86\release\translations\qt_uk.qm" SetOutPath "$INSTDIR" File "..\binaries\windows\msvc2015\x86\release\zh.qm" File "..\binaries\windows\msvc2015\x86\release\zh.ts" File "vc_redist.x86.exe" ExecWait '"$INSTDIR\vc_redist.x86.exe" /q' SectionEnd Section -AdditionalIcons WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateShortCut "$SMPROGRAMS\Lucky-My application\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" CreateShortCut "$SMPROGRAMS\Lucky-My application\Uninstall.lnk" "$INSTDIR\uninst.exe" SectionEnd Section -Post WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\MessageStorage.exe" WriteRegStr HKCU "Software\QCreator Path" "" $INSTDIR WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\MessageStorage.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" SectionEnd /****************************** * 以下是安装程序的卸载部分 * ******************************/ Section Uninstall Delete "$INSTDIR\${PRODUCT_NAME}.url" Delete "$INSTDIR\uninst.exe" Delete "$INSTDIR\vc_redist.x86.exe" Delete "$INSTDIR\zh.ts" Delete "$INSTDIR\zh.qm" Delete "$INSTDIR\translations\qt_uk.qm" Delete "$INSTDIR\translations\qt_sk.qm" Delete "$INSTDIR\translations\qt_ru.qm" Delete "$INSTDIR\translations\qt_pl.qm" Delete "$INSTDIR\translations\qt_lv.qm" Delete "$INSTDIR\translations\qt_ko.qm" Delete "$INSTDIR\translations\qt_ja.qm" Delete "$INSTDIR\translations\qt_it.qm" Delete "$INSTDIR\translations\qt_hu.qm" Delete "$INSTDIR\translations\qt_he.qm" Delete "$INSTDIR\translations\qt_gd.qm" Delete "$INSTDIR\translations\qt_fr.qm" Delete "$INSTDIR\translations\qt_fi.qm" Delete "$INSTDIR\translations\qt_es.qm" Delete "$INSTDIR\translations\qt_en.qm" Delete "$INSTDIR\translations\qt_de.qm" Delete "$INSTDIR\translations\qt_da.qm" Delete "$INSTDIR\translations\qt_cs.qm" Delete "$INSTDIR\translations\qt_ca.qm" Delete "$INSTDIR\translations\qt_bg.qm" Delete "$INSTDIR\translations\qt_ar.qm" Delete "$INSTDIR\tools\xmllist.exe" Delete "$INSTDIR\tools\SQLManagement1.exe" Delete "$INSTDIR\styles\qwindowsvistastyle.dll" Delete "$INSTDIR\sqldrivers\qsqlpsql.dll" Delete "$INSTDIR\sqldrivers\qsqlodbc.dll" Delete "$INSTDIR\sqldrivers\qsqlmysql.dll" Delete "$INSTDIR\sqldrivers\qsqlite.dll" Delete "$INSTDIR\script.db" Delete "$INSTDIR\Qt5Xml.dll" Delete "$INSTDIR\Qt5Widgets.dll" Delete "$INSTDIR\Qt5Svg.dll" Delete "$INSTDIR\Qt5Sql.dll" Delete "$INSTDIR\Qt5Network.dll" Delete "$INSTDIR\Qt5Gui.dll" Delete "$INSTDIR\Qt5Core.dll" Delete "$INSTDIR\QCreator.exe" Delete "$INSTDIR\pscp.exe" Delete "$INSTDIR\plugins\SocketPortPlugin.lib" Delete "$INSTDIR\plugins\SocketPortPlugin.exp" Delete "$INSTDIR\plugins\SocketPortPlugin.dll" Delete "$INSTDIR\plugins\SignInPlugin.lib" Delete "$INSTDIR\plugins\SignInPlugin.exp" Delete "$INSTDIR\plugins\SignInPlugin.dll" Delete "$INSTDIR\plugins\RtdbPlugin.lib" Delete "$INSTDIR\plugins\RtdbPlugin.exp" Delete "$INSTDIR\plugins\RtdbPlugin.dll" Delete "$INSTDIR\plugins\ProcessManagerPlugin.lib" Delete "$INSTDIR\plugins\ProcessManagerPlugin.exp" Delete "$INSTDIR\plugins\ProcessManagerPlugin.dll" Delete "$INSTDIR\plugins\pluginsBrowserPlugin.dll" Delete "$INSTDIR\plugins\OutputWidgetPlugin.lib" Delete "$INSTDIR\plugins\OutputWidgetPlugin.exp" Delete "$INSTDIR\plugins\OutputWidgetPlugin.dll" Delete "$INSTDIR\plugins\FtpPlugin.lib" Delete "$INSTDIR\plugins\FtpPlugin.exp" Delete "$INSTDIR\plugins\FtpPlugin.dll" Delete "$INSTDIR\plugins\FirManageplugin.lib" Delete "$INSTDIR\plugins\FirManageplugin.exp" Delete "$INSTDIR\plugins\FirManageplugin.dll" Delete "$INSTDIR\plugins\demoPlugin.lib" Delete "$INSTDIR\plugins\demoPlugin.exp" Delete "$INSTDIR\plugins\demoPlugin.dll" Delete "$INSTDIR\plugins\DefaultProjectPlugin.lib" Delete "$INSTDIR\plugins\DefaultProjectPlugin.exp" Delete "$INSTDIR\plugins\DefaultProjectPlugin.dll" Delete "$INSTDIR\plink.exe" Delete "$INSTDIR\platforms\qwindows.dll" Delete "$INSTDIR\opengl32sw.dll" Delete "$INSTDIR\MessageStorage.exe" Delete "$INSTDIR\map.xml" Delete "$INSTDIR\map-1.xml" Delete "$INSTDIR\map - 副本.xml" Delete "$INSTDIR\libGLESV2.dll" Delete "$INSTDIR\libEGL.dll" Delete "$INSTDIR\imageformats\qwebp.dll" Delete "$INSTDIR\imageformats\qwbmp.dll" Delete "$INSTDIR\imageformats\qtiff.dll" Delete "$INSTDIR\imageformats\qtga.dll" Delete "$INSTDIR\imageformats\qsvg.dll" Delete "$INSTDIR\imageformats\qjpeg.dll" Delete "$INSTDIR\imageformats\qico.dll" Delete "$INSTDIR\imageformats\qicns.dll" Delete "$INSTDIR\imageformats\qgif.dll" Delete "$INSTDIR\iconengines\qsvgicon.dll" Delete "$INSTDIR\firmware.db" Delete "$INSTDIR\driver.db" Delete "$INSTDIR\D3Dcompiler_47.dll" Delete "$INSTDIR\config.xls" Delete "$INSTDIR\bearer\qgenericbearer.dll" Delete "$SMPROGRAMS\Lucky-My application\Uninstall.lnk" Delete "$SMPROGRAMS\Lucky-My application\Website.lnk" Delete "$DESKTOP\Lucky-My application.lnk" Delete "$SMPROGRAMS\Lucky-My application\Lucky-My application.lnk" RMDir "$SMPROGRAMS\Lucky-My application" RMDir "$INSTDIR\translations" RMDir "$INSTDIR\tools" RMDir "$INSTDIR\styles" RMDir "$INSTDIR\sqldrivers" RMDir "$INSTDIR\plugins" RMDir "$INSTDIR\platforms" RMDir "$INSTDIR\imageformats" RMDir "$INSTDIR\iconengines" RMDir "$INSTDIR\bearer" RMDir "$INSTDIR" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" DeleteRegKey /ifempty ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey /ifempty HKCU "Software\QCreator Path" 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
读取注册表路径示例
; 该脚本使用 HM VNISEdit 脚本编辑器向导产生 ; 安装程序初始定义常量 !define PRODUCT_NAME "DBFILE application" !define PRODUCT_VERSION "1.1.1.1" !define PRODUCT_PUBLISHER "DBFILE company, Inc." !define PRODUCT_WEB_SITE "http://www.DBFILEmycompany.com" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" SetCompressor lzma ; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------ !include "MUI.nsh" ; MUI 预定义常量 !define MUI_ABORTWARNING !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" ; 语言选择窗口常量设置 !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}" !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language" ; 欢迎页面 !insertmacro MUI_PAGE_WELCOME ; 许可协议页面 ; 安装目录选择页面 !insertmacro MUI_PAGE_DIRECTORY ; 安装过程页面 !insertmacro MUI_PAGE_INSTFILES ; 安装完成页面 !insertmacro MUI_PAGE_FINISH ; 安装卸载过程页面 !insertmacro MUI_UNPAGE_INSTFILES ; 安装界面包含的语言设置 !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "SimpChinese" ; 安装预释放文件 !insertmacro MUI_RESERVEFILE_LANGDLL !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ; ------ MUI 现代界面定义结束 ------ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "dbFileSetup.exe" InstallDir "$PROGRAMFILES\My applicationDBFILE" InstallDirRegKey HKCU "Software\QCreator Path" "" ShowInstDetails show ShowUnInstDetails show Section "MainSection" SEC01 SetOutPath "$INSTDIR" SetOverwrite ifnewer File "script.db" File "firmware.db" File "driver.db" SectionEnd Section -AdditionalIcons WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateDirectory "$SMPROGRAMS\My applicationDBFILE" CreateShortCut "$SMPROGRAMS\My applicationDBFILE\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" CreateShortCut "$SMPROGRAMS\My applicationDBFILE\Uninstall.lnk" "$INSTDIR\uninst.exe" SectionEnd Section -Post WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" SectionEnd #-- 根据 NSIS 脚本编辑规则,所有 Function 区段必须放置在 Section 区段之后编写,以避免安装程序出现未可预知的问题。--# Function .onInit !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd /****************************** * 以下是安装程序的卸载部分 * ******************************/ Section Uninstall Delete "$INSTDIR\${PRODUCT_NAME}.url" Delete "$INSTDIR\uninst.exe" Delete "$INSTDIR\driver.db" Delete "$INSTDIR\firmware.db" Delete "$INSTDIR\script.db" Delete "$SMPROGRAMS\My applicationDBFILE\Uninstall.lnk" Delete "$SMPROGRAMS\My applicationDBFILE\Website.lnk" RMDir "$SMPROGRAMS\My applicationDBFILE" RMDir "$INSTDIR" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" SetAutoClose true SectionEnd #-- 根据 NSIS 脚本编辑规则,所有 Function 区段必须放置在 Section 区段之后编写,以避免安装程序出现未可预知的问题。--# Function un.onInit !insertmacro MUI_UNGETLANGUAGE MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,及其所有的组件?" IDYES +2 Abort FunctionEnd Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。" FunctionEnd```
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。