程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 更多關於編程 >> 如何編寫NSIS自定義界面腳本

如何編寫NSIS自定義界面腳本

編輯:更多關於編程

       微軟公司推出的近兩款操作系統Windows 8和windows 10都采用了向導界面樣式,其實Modern UI(新式用戶界面)中有與此類似的界面樣式,如果用戶設計一個歡迎頁面,可以在上面添加安裝介紹、是否立即執行等選項。下面我們就具體看看它的實現代碼。

    如何編寫NSIS自定義界面腳本 三聯

      ;NSIS Modern User Interface

      ;Basic Example Script

      ;Written by Joost Verburg

      ;--------------------------------

      ;Include Modern UI

      !include "MUI2.nsh"

      ;--------------------------------

      ;General

      ;Name and file

      Name "Modern UI Test"

      OutFile "Basic.exe"

      ;Default installation folder

      InstallDir "$LOCALAPPDATAModern UI Test"

      ;Get installation folder from registry if available

      InstallDirRegKey HKCU "SoftwareModern UI Test" ""

      ;Request application privileges for Windows Vista

      RequestExecutionLevel user

      ;--------------------------------

      ;Interface Settings

      !define MUI_ABORTWARNING

      ;--------------------------------

      ;Pages

      !insertmacro MUI_PAGE_LICENSE "${NSISDIR}DocsModern UILicense.txt"

      !insertmacro MUI_PAGE_COMPONENTS

      !insertmacro MUI_PAGE_DIRECTORY

      !insertmacro MUI_PAGE_INSTFILES

      !insertmacro MUI_UNPAGE_CONFIRM

      !insertmacro MUI_UNPAGE_INSTFILES

      ;--------------------------------

      ;Languages

      !insertmacro MUI_LANGUAGE "English"

      ;--------------------------------

      ;Installer Sections

      Section "Dummy Section" SecDummy

      SetOutPath "$INSTDIR"

      ;ADD YOUR OWN FILES HERE...

      ;Store installation folder

      WriteRegStr HKCU "SoftwareModern UI Test" "" $INSTDIR

      ;Create uninstaller

      WriteUninstaller "$INSTDIRUninstall.exe"

      SectionEnd

      ;--------------------------------

      ;Descriptions

      ;Language strings

      LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."

      ;Assign language strings to sections

      !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN

      !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)

      !insertmacro MUI_FUNCTION_DESCRIPTION_END

      ;--------------------------------

      ;Uninstaller Section

      Section "Uninstall"

      ;ADD YOUR OWN FILES HERE...

      Delete "$INSTDIRUninstall.exe"

      RMDir "$INSTDIR"

      DeleteRegKey /ifempty HKCU "SoftwareModern UI Test"

      SectionEnd

    1. 上一頁:
    2. 下一頁:
    Copyright © 程式師世界 All Rights Reserved