您好,登錄后才能下訂單哦!
!addincludedir "include" Var MSG ;MSG變量必須定義,而且在最前面,否則WndProc::onCallback不工作,插件中需要這個消息變量,用于記錄消息信息 Var Dialog ;Dialog變量也需要定義,他可能是NSIS默認的對話框變量用于保存窗體中控件的信息 Var BGImage ;背景大圖 Var ImageHandle Var BGImage1 ;背景大圖 Var ImageHandle1 ;Var BGImage2 ;背景大圖 ;Var ImageHandle2 ;Var STATE ;Var WarningForm Var Txt_Browser Var btn_Browser Var btn_in Var btn_ins Var btn_back Var btn_Close Var btn_instetup Var btn_instend Var btn_instend1 Var btn_Licenseback Var btn_Gracenoteback Var Txt_Xllicense Var Rtf_license Var Txt_Gracenote Var Rtf_Gracenote Var Txt_ji Var Ckbox0 Var Ckbox1 Var Ckbox1_State Var Ckbox2 Var Ckbox2_State Var Ckbox3 Var Ckbox3_State Var ckbox4 Var ckbox5 ;---------------------------全局編譯腳本預(yù)定義的常量----------------------------------------------------- !include x64.nsh !include WinVer.nsh !define PRODUCT_NAME "Scale3DC汽車衡稱重管理系統(tǒng)" !define PRODUCT_VERSION "2018.0.0.0" !define PRODUCT_PUBLISHER "Tencent" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" ;---------------------------設(shè)置軟件壓縮類型(也可以通過外面編譯腳本控制)------------------------------------ SetCompressor lzma SetCompress force ;應(yīng)用程序顯示名字 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" ;應(yīng)用程序輸出文件名 OutFile "${PRODUCT_NAME}.exe" ;安裝路徑 !define DIR "$PROGRAMFILES\Scale3DC" ;請在這里定義路徑 InstallDir "${DIR}" InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" ;請求提升管理員權(quán)限 RequestExecutionLevel admin ShowInstDetails nevershow ;設(shè)置是否顯示安裝詳細信息。 ShowUnInstDetails nevershow ;設(shè)置是否顯示刪除詳細信息。 ; MUI 預(yù)定義常量 ;!define MUI_ABORTWARNING ;退出提示 ;!define MUI_CUSTOMFUNCTION_ABORT ABORT ;MUI_CUSTOMFUNCTION_ABORT ;安裝圖標的路徑名字 !define MUI_ICON "Icon\install.ico" ;卸載圖標的路徑名字 !define MUI_UNICON "Icon\win-uninstall.ico" ;使用的UI !define MUI_UI "UI\mod.exe" ;使用ReserveFile是加快安裝包展開速度,具體請看幫助 ReserveFile "images\bg.bmp" ReserveFile "images\bg2.bmp" ReserveFile "images\bg3.bmp" ReserveFile "images\browse.bmp" ReserveFile "images\close.bmp" ReserveFile "images\custom.bmp" ReserveFile "images\empty_bg.bmp" ReserveFile "images\express.bmp" ReserveFile "images\finish.bmp" ReserveFile "images\full_bg.bmp" ReserveFile "images\onekey.bmp" ReserveFile "images\strongbtn.bmp" ReserveFile "images\weakbtn.bmp" ;輪展數(shù)據(jù) ReserveFile "images\Slides.dat" ReserveFile "images\InstallingBG01.png" ReserveFile "images\InstallingBG02.png" ReserveFile "images\InstallingBG03.png" ReserveFile "images\InstallingBG04.png" ;DLL ReserveFile `${NSISDIR}\Plugins\x86-ansi\nsDialogs.dll` ReserveFile `${NSISDIR}\Plugins\x86-ansi\nsWindows.dll` ReserveFile `${NSISDIR}\Plugins\x86-ansi\SkinBtn.dll` ReserveFile `${NSISDIR}\Plugins\x86-ansi\SkinProgress.dll` ReserveFile `${NSISDIR}\Plugins\x86-ansi\System.dll` ReserveFile `${NSISDIR}\Plugins\x86-ansi\WndProc.dll` ReserveFile `${NSISDIR}\Plugins\x86-ansi\nsisSlideshow.dll` ReserveFile `${NSISDIR}\Plugins\x86-ansi\FindProcDLL.dll` ; ------ MUI 現(xiàn)代界面定義 (1.67 版本以上兼容) ------ !include "MUI.nsh" !include "WinCore.nsh" !include "nsWindows.nsh" !include "LogicLib.nsh" !include "WinMessages.nsh" !include "LoadRTF.nsh" !define MUI_CUSTOMFUNCTION_GUIINIT onGUIInit ;自定義頁面 Page custom Page.1 Page.1leave ; 許可協(xié)議頁面 ;!define MUI_LICENSEPAGE_CHECKBOX ; 安裝目錄選擇頁面 ;!insertmacro MUI_PAGE_DIRECTORY ; 安裝過程頁面 !define MUI_PAGE_CUSTOMFUNCTION_SHOW InstFilesPageShow !insertmacro MUI_PAGE_INSTFILES ; 安裝完成頁面 Page custom Page.3 ;這個不要刪除,否則自動跳轉(zhuǎn)出問題 Page custom Page.4 ; 安裝卸載過程頁面 !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ; 安裝界面包含的語言設(shè)置 !insertmacro MUI_LANGUAGE "SimpChinese" VIProductVersion "0.0.0.0" ;←↓版本啦 VIAddVersionKey /LANG=2052 "ProductName" "${PRODUCT_NAME}" VIAddVersionKey /LANG=2052 "Comments" "http://www.nbzycn.com/" ;請自己修改 VIAddVersionKey /LANG=2052 "CompanyName" "Tencent" VIAddVersionKey /LANG=2052 "LegalCopyright" "Copyright (c) yu" VIAddVersionKey /LANG=2052 "FileDescription" "${PRODUCT_NAME}" VIAddVersionKey /LANG=2052 "FileVersion" "${PRODUCT_VERSION}" ;------------------------------------------------------MUI 現(xiàn)代界面定義以及函數(shù)結(jié)束------------------------ Function .onInit InitPluginsDir ;初始化插件 StrCpy $Ckbox1_State ${BST_CHECKED} StrCpy $Ckbox2_State ${BST_CHECKED} StrCpy $Ckbox3_State ${BST_CHECKED} File `/ONAME=$PLUGINSDIR\bg.bmp` `images\bg.bmp` ;第一大背景 File `/oname=$PLUGINSDIR\bg2.bmp` `images\bg2.bmp` ;第二大背景 File `/oname=$PLUGINSDIR\bg3.bmp` `images\bg3.bmp` ;完成頁背景 File `/oname=$PLUGINSDIR\btn_onekey.bmp` `images\onekey.bmp` ;快速安裝 File `/oname=$PLUGINSDIR\btn_custom.bmp` `images\custom.bmp` ;自定義安裝 File `/oname=$PLUGINSDIR\btn_browse.bmp` `images\browse.bmp` ;瀏覽按鈕 File `/oname=$PLUGINSDIR\btn_strongbtn.bmp` `images\strongbtn.bmp` ;立即安裝 File `/oname=$PLUGINSDIR\btn_finish.bmp` `images\finish.bmp` ;安裝完成 File `/oname=$PLUGINSDIR\btn_weakbtn.bmp` `images\weakbtn.bmp` ;返回 File `/oname=$PLUGINSDIR\btn_express.bmp` `images\express.bmp` ;立即體驗 File `/oname=$PLUGINSDIR\btn_Close.bmp` `images\Close.bmp` ;關(guān)閉 ;進度條皮膚 File `/oname=$PLUGINSDIR\Progress.bmp` `images\empty_bg.bmp` File `/oname=$PLUGINSDIR\ProgressBar.bmp` `images\full_bg.bmp` ;協(xié)議 File `/oname=$PLUGINSDIR\license.rtf` `rtf\license.rtf` File `/oname=$PLUGINSDIR\Gracenote.rtf` `rtf\Gracenote.rtf` ;初始化 SkinBtn::Init "$PLUGINSDIR\btn_onekey.bmp" SkinBtn::Init "$PLUGINSDIR\btn_custom.bmp" SkinBtn::Init "$PLUGINSDIR\btn_browse.bmp" SkinBtn::Init "$PLUGINSDIR\btn_strongbtn.bmp" SkinBtn::Init "$PLUGINSDIR\btn_finish.bmp" SkinBtn::Init "$PLUGINSDIR\btn_weakbtn.bmp" SkinBtn::Init "$PLUGINSDIR\btn_express.bmp" SkinBtn::Init "$PLUGINSDIR\btn_Close.bmp" FunctionEnd Function onGUIInit ;檢查重復(fù)運行 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "Scale3DC") i .r1 ?e' Pop $R1 ;;;;$$$$$安裝程序已經(jīng)運行 StrCmp $R1 0 +3 MessageBox MB_OK|MB_ICONINFORMATION|MB_TOPMOST "程序已經(jīng)在運行。" Abort ;檢測是否正在運行 RETRY: FindProcDLL::FindProc "Scalea3DC.exe" ;檢測的運行進程名稱 StrCmp $R0 1 0 +3 MessageBox MB_RETRYCANCEL|MB_ICONINFORMATION|MB_TOPMOST '檢測到 "${PRODUCT_NAME}" 正在運行,請先關(guān)閉后重試,或者點擊"取消"退出!' IDRETRY RETRY Quit ;消除邊框 System::Call `user32::SetWindowLong(i$HWNDPARENT,i${GWL_STYLE},0x9480084C)i.R0` ;隱藏一些既有控件 GetDlgItem $0 $HWNDPARENT 1034 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1035 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1036 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1037 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1038 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1039 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1256 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1028 ShowWindow $0 ${SW_HIDE} ${NSW_SetWindowSize} $HWNDPARENT 589 439 ;改變主窗體大小 System::Call User32::GetDesktopWindow()i.R0 ;圓角 System::Alloc 16 System::Call user32::GetWindowRect(i$HWNDPARENT,isR0) System::Call *$R0(i.R1,i.R2,i.R3,i.R4) IntOp $R3 $R3 - $R1 IntOp $R4 $R4 - $R2 System::Call gdi32::CreateRoundRectRgn(i0,i0,iR3,iR4,i4,i4)i.r0 System::Call user32::SetWindowRgn(i$HWNDPARENT,ir0,i1) System::Free $R0 ; GetDlgItem $R0 $HWNDPARENT 1044 ; System::Call "user32::MoveWindow(i R0, i 0, i 0, i 374, i 153) i r2" FunctionEnd ;處理無邊框移動 Function onGUICallback ${If} $MSG = ${WM_LBUTTONDOWN} SendMessage $HWNDPARENT ${WM_NCLBUTTONDOWN} ${HTCAPTION} $0 ${EndIf} FunctionEnd Function Page.1 GetDlgItem $0 $HWNDPARENT 1 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 2 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 3 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1990 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1991 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 1992 ShowWindow $0 ${SW_HIDE} nsDialogs::Create 1044 Pop $0 ${If} $0 == error Abort ${EndIf} SetCtlColors $0 "" transparent ;背景設(shè)成透明 ${NSW_SetWindowSize} $0 588 438 ;改變Page大小 ;讀取RTF的文本框 nsDialogs::CreateControl "RichEdit20A" \ ${ES_READONLY}|${WS_VISIBLE}|${WS_CHILD}|${WS_TABSTOP}|${WS_VSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN} \ ${WS_EX_STATICEDGE} 16u 28u 360u 229u '' Pop $rtf_License ${LoadRTF} '$PLUGINSDIR\license.rtf' $rtf_License ShowWindow $rtf_License ${SW_HIDE} nsDialogs::CreateControl "RichEdit20A" \ ${ES_READONLY}|${WS_VISIBLE}|${WS_CHILD}|${WS_TABSTOP}|${WS_VSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN} \ ${WS_EX_STATICEDGE} 16u 28u 360u 229u '' Pop $Rtf_Gracenote ${LoadRTF} '$PLUGINSDIR\Gracenote.rtf' $Rtf_Gracenote ShowWindow $Rtf_Gracenote ${SW_HIDE} ;協(xié)議確定按鈕 ${NSD_CreateButton} 180u 263u 55 30 "確定" Pop $btn_Licenseback SkinBtn::Set /IMGID=$PLUGINSDIR\btn_weakbtn.bmp $btn_Licenseback GetFunctionAddress $3 Licenseback SkinBtn::onClick $btn_Licenseback $3 SetCtlColors $btn_Licenseback 7F7F7F transparent ShowWindow $btn_Licenseback ${SW_HIDE} ;第三方協(xié)議確定按鈕 ${NSD_CreateButton} 310u 263u 55 30 "確定" Pop $btn_Gracenoteback SkinBtn::Set /IMGID=$PLUGINSDIR\btn_weakbtn.bmp $btn_Gracenoteback GetFunctionAddress $3 Gracenoteback SkinBtn::onClick $btn_Gracenoteback $3 SetCtlColors $btn_Gracenoteback 7F7F7F transparent ShowWindow $btn_Gracenoteback ${SW_HIDE} ;自定義安裝按鈕 ${NSD_CreateButton} 310u 263u 98 17 "" Pop $btn_ins SkinBtn::Set /IMGID=$PLUGINSDIR\btn_custom.bmp $btn_ins GetFunctionAddress $3 onClickint SkinBtn::onClick $btn_ins $3 ;快速安裝 ${NSD_CreateButton} 126u 204u 252 64 "" Pop $btn_in SkinBtn::Set /IMGID=$PLUGINSDIR\btn_onekey.bmp $btn_in GetFunctionAddress $3 onClickins SkinBtn::onClick $btn_in $3 ;最小化按鈕 ; ${NSD_CreateButton} 350u 3u 22 22 "" ; Pop $btn_mini ; SkinBtn::Set /IMGID=$PLUGINSDIR\btn_mini.bmp $btn_mini ; GetFunctionAddress $3 onClickmini ; SkinBtn::onClick $btn_mini $3 ;關(guān)閉按鈕 ${NSD_CreateButton} 372u 8u 24 20 "" Pop $btn_Close SkinBtn::Set /IMGID=$PLUGINSDIR\btn_Close.bmp $btn_Close GetFunctionAddress $3 ABORT SkinBtn::onClick $btn_Close $3 ;立即安裝 ${NSD_CreateButton} 284u 260u 82 26 "立即安裝" Pop $btn_instetup SkinBtn::Set /IMGID=$PLUGINSDIR\btn_strongbtn.bmp $btn_instetup GetFunctionAddress $3 onClickins SkinBtn::onClick $btn_instetup $3 SetCtlColors $btn_instetup FFFFFF transparent ShowWindow $btn_instetup ${SW_HIDE} ;返回 ${NSD_CreateButton} 344u 260u 56 26 "返回" Pop $btn_back SkinBtn::Set /IMGID=$PLUGINSDIR\btn_weakbtn.bmp $btn_back GetFunctionAddress $3 onClickBack SkinBtn::onClick $btn_back $3 SetCtlColors $btn_back 7F7F7F transparent ShowWindow $btn_back ${SW_HIDE} #------------------------------------------ #許可協(xié)議 #------------------------------------------ ${NSD_CreateCheckbox} 17u 265u 63u 12u "同意臻譽的" Pop $Ckbox0 SetCtlColors $Ckbox0 "" FFFFFF ${NSD_Check} $Ckbox0 ${NSD_OnClick} $Ckbox0 Chklicense ${NSD_CreateLabel} 130u 267u 10u 12u "及" Pop $txt_ji SetCtlColors $txt_ji "" FFFFFF ;前景色,背景設(shè)成透明 ${NSD_CreateLink} 80u 267u 48u 10u "用戶許可協(xié)議" Pop $Txt_Xllicense SetCtlColors $Txt_Xllicense 5ba900 FFFFFF ${NSD_OnClick} $Txt_Xllicense xllicense ${NSD_CreateLink} 140u 267u 60u 10u "第三方用戶協(xié)議" Pop $Txt_Gracenote SetCtlColors $Txt_Gracenote 5ba900 FFFFFF ${NSD_OnClick} $Txt_Gracenote Gracenote #------------------------------------------ #可選項1 #------------------------------------------ ${NSD_CreateCheckbox} 17u 216u 80u 12u "創(chuàng)建桌面圖標" Pop $Ckbox1 SetCtlColors $Ckbox1 "" FFFFFF ;前景色,背景設(shè)成透明 ShowWindow $Ckbox1 ${SW_HIDE} ${NSD_Check} $Ckbox1 #------------------------------------------ #可選項2 #------------------------------------------ ; ${NSD_CreateCheckbox} 130u 216u 80u 12u "添加到快速啟動欄" ; Pop $Ckbox2 ; SetCtlColors $Ckbox2 "" FFFFFF ;前景色,背景設(shè)成透明 ; ShowWindow $Ckbox2 ${SW_HIDE} ; ${NSD_Check} $Ckbox2 #------------------------------------------ #可選項3 #------------------------------------------ ; ${NSD_CreateCheckbox} 240u 216u 90u 12u "設(shè)為默認音樂播放器" ; Pop $Ckbox3 ; SetCtlColors $Ckbox3 "" FFFFFF ;前景色,背景設(shè)成透明 ; ShowWindow $Ckbox3 ${SW_HIDE} ;${NSD_SetState} $Checkbox1 ${BST_CHECKED} ;創(chuàng)建安裝目錄輸入文本框 ${NSD_CreateText} 21u 183u 290u 22u "${DIR}" Pop $Txt_Browser SetCtlColors $Txt_Browser "" FFFFFF ;背景設(shè)成透明 ;${NSD_AddExStyle} $Txt_Browser ${WS_EX_WINDOWEDGE} CreateFont $1 "tahoma" "10" "500" SendMessage $Txt_Browser ${WM_SETFONT} $1 1 ShowWindow $Txt_Browser ${SW_HIDE} ;創(chuàng)建更改路徑文件夾按鈕 ${NSD_CreateButton} 312u 273U 76 36 "瀏覽..." Pop $btn_Browser SkinBtn::Set /IMGID=$PLUGINSDIR\btn_browse.bmp $btn_Browser GetFunctionAddress $3 onClickSelectPath SkinBtn::onClick $btn_Browser $3 SetCtlColors $btn_Browser 7F7F7F transparent ;前景色,背景設(shè)成透明 ShowWindow $btn_Browser ${SW_HIDE} ${NSD_CreateBitmap} 0 0 100% 100% "" Pop $BGImage1 ${NSD_SetImage} $BGImage1 $PLUGINSDIR\bg2.bmp $ImageHandle1 ShowWindow $BGImage1 ${SW_HIDE} ;貼背景大圖 ${NSD_CreateBitmap} 0 0 100% 100% "" Pop $BGImage ${NSD_SetImage} $BGImage $PLUGINSDIR\bg.bmp $ImageHandle GetFunctionAddress $0 onGUICallback WndProc::onCallback $BGImage $0 ;處理無邊框窗體移動 WndProc::onCallback $BGImage1 $0 ;處理無邊框窗體移動 nsDialogs::Show ${NSD_FreeImage} $ImageHandle ${NSD_FreeImage} $ImageHandle1 FunctionEnd Function Page.1leave ${NSD_GetState} $Ckbox1 $Ckbox1_State ${NSD_GetState} $Ckbox2 $Ckbox2_State ${NSD_GetState} $Ckbox3 $Ckbox3_State FunctionEnd Function InstFilesPagePRO GetDlgItem $0 $HWNDPARENT 1 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 2 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 3 FunctionEnd Function InstFilesPageShow FindWindow $R2 "#32770" "" $HWNDPARENT ShowWindow $0 ${SW_HIDE} GetDlgItem $1 $R2 1027 ShowWindow $1 ${SW_HIDE} ;存入輪展圖片 File '/oname=$PLUGINSDIR\Slides.dat' 'images\Slides.dat' File '/oname=$PLUGINSDIR\InstallingBG01.png' 'images\InstallingBG01.png' File '/oname=$PLUGINSDIR\InstallingBG02.png' 'images\InstallingBG02.png' File '/oname=$PLUGINSDIR\InstallingBG03.png' 'images\InstallingBG03.png' File '/oname=$PLUGINSDIR\InstallingBG04.png' 'images\InstallingBG04.png' StrCpy $R0 $R2 ;改變頁面大小,不然貼圖不能全頁 System::Call "user32::MoveWindow(i R0, i 0, i 0, i 588, i 438) i r2" GetFunctionAddress $0 onGUICallback WndProc::onCallback $R0 $0 ;處理無邊框窗體移動 GetDlgItem $R0 $R2 1004 ;設(shè)置進度條位置 System::Call "user32::MoveWindow(i R0, i 30, i 302, i 537, i 12) i r2" GetDlgItem $R1 $R2 1006 ;進度條上面的標簽 SetCtlColors $R1 "" FFFFFF ;背景設(shè)成F6F6F6,注意顏色不能設(shè)為透明,否則重疊 System::Call "user32::MoveWindow(i R1, i 30, i 275, i 290, i 12) i r2" GetDlgItem $R8 $R2 1016 ;SetCtlColors $R8 "" F6F6F6 ;背景設(shè)成F6F6F6,注意顏色不能設(shè)為透明,否則重疊 System::Call "user32::MoveWindow(i R8, i 0, i 0, i 588, i 216) i r2" FindWindow $R2 "#32770" "" $HWNDPARENT ;獲取1995并設(shè)置圖片 GetDlgItem $R0 $R2 1995 System::Call "user32::MoveWindow(i R0, i 0, i 0, i 498, i 373) i r2" ${NSD_SetImage} $R0 $PLUGINSDIR\bg2.bmp $ImageHandle ;這里是給進度條貼圖 FindWindow $R2 "#32770" "" $HWNDPARENT GetDlgItem $5 $R2 1004 SkinProgress::Set $5 "$PLUGINSDIR\ProgressBar.bmp" "$PLUGINSDIR\Progress.bmp" FunctionEnd ;完成頁面 Function Page.3 GetDlgItem $0 $HWNDPARENT 1 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 2 ShowWindow $0 ${SW_HIDE} GetDlgItem $0 $HWNDPARENT 3 ShowWindow $0 ${SW_HIDE} nsDialogs::Create 1044 Pop $0 ${If} $0 == error Abort ${EndIf} SetCtlColors $0 "" transparent ;背景設(shè)成透明 ${NSW_SetWindowSize} $0 588 438 ;改變Page大小 ${NSD_CreateCheckbox} 20u 160u 166u 10u "立刻啟動Scale3DC稱重軟件" Pop $Ckbox4 SetCtlColors $Ckbox4 "" FFFFFF ;ShowWindow $Ckbox4 ${SW_HIDE} ;如果不需要可以使用這行隱藏 ;${NSD_Check} $Ckbox4 ;默認勾選 ; ${NSD_CreateCheckbox} 20u 180u 200u 10u "推薦您安裝QQ游戲,全球最大在線休閑游戲平臺" ; Pop $ckbox5 ; SetCtlColors $ckbox5 "" FFFFFF ;ShowWindow $ckbox5 ${SW_HIDE} ;如果不需要可以使用這行隱藏 ;${NSD_Check} $ckbox5 ;默認勾選 ${NSD_CreateLink} 277u 122u 56u 10u "臻譽官網(wǎng)下載" Pop $1 SetCtlColors $1 FFFFFF B0B18D ${NSD_OnClick} $1 onClickmusic ;立即體驗 ${NSD_CreateButton} 86u 226u 160 54 "" Pop $btn_instend SkinBtn::Set /IMGID=$PLUGINSDIR\btn_express.bmp $btn_instend GetFunctionAddress $3 onClickexpress SkinBtn::onClick $btn_instend $3 ;安裝完成 ${NSD_CreateButton} 200u 226u 160 54 "" Pop $btn_instend1 SkinBtn::Set /IMGID=$PLUGINSDIR\btn_finish.bmp $btn_instend1 GetFunctionAddress $3 onClickend SkinBtn::onClick $btn_instend1 $3 ;貼背景大圖 ${NSD_CreateBitmap} 0 0 100% 100% "" Pop $BGImage ${NSD_SetImage} $BGImage $PLUGINSDIR\bg3.bmp $ImageHandle GetFunctionAddress $0 onGUICallback WndProc::onCallback $BGImage $0 ;處理無邊框窗體移動 nsDialogs::Show ${NSD_FreeImage} $ImageHandle FunctionEnd Function Page.4 FunctionEnd Section MainSetup DetailPrint "正在安裝..." Sleep 1000 SetDetailsPrint None ;不顯示信息 nsisSlideshow::Show /NOUNLOAD /auto=$PLUGINSDIR\Slides.dat Sleep 500 ;在安裝程序里暫停執(zhí)行 "休眠時間(單位為:ms)" 毫秒。"休眠時間(單位為:ms)" 可以是一個變量, 例如 "$0" 或一個數(shù)字,例如 "666"。 SetOutPath $INSTDIR ; 打包實體內(nèi)容 File /r "C:\Program Files (x86)\Scale3DC\*.*" ; 注冊組件 RegDLL "$INSTDIR\grdes6.dll" RegDLL "$INSTDIR\gregn6.dll" ;Store installation folder保存安裝文件夾件 WriteRegStr HKCU "Software\Scale3DC" "" $INSTDIR ;在桌面上建立快捷方式。 CreateShortCut "$DESKTOP\Scale3DC稱重軟件.lnk" "$INSTDIR\Scale3DC.exe" CreateShortCut "$DESKTOP\ZYCOMM串口調(diào)試工具v4.0.lnk" "$INSTDIR\ZYCOMM\ZYCOMM.exe" ;----------------------------------------------------- ;Create uninstaller創(chuàng)建卸載程序 ${If} ${RunningX64} ${DisableX64FSRedirection} WriteUninstaller "$INSTDIR\uninst.exe" ${EnableX64FSRedirection} ${else} WriteUninstaller "$INSTDIR\uninst.exe" ${endif} WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$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}" Sleep 50 Sleep 50 Sleep 50 Sleep 500 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 500 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 500 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 500 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 Sleep 50 /* ${If} $Ckbox1_State == 1 DetailPrint "現(xiàn)在是選中狀態(tài),這里可以寫代碼" ${EndIf} */ ;MessageBox MB_OK '判斷選中項,選中為1,否則0:$\r$\n創(chuàng)建桌面圖標:安裝目錄:$INSTDIR' nsisSlideshow::Stop SetAutoClose true SectionEnd Section -AdditionalIcons SetOutPath $INSTDIR WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateDirectory "$SMPROGRAMS\Scale3DC" CreateShortCut "$SMPROGRAMS\Scale3DC\Scale3DC.lnk" "$INSTDIR\${PRODUCT_NAME}.url" CreateShortCut "$SMPROGRAMS\Scale3DC\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 Function ABORT MessageBox MB_ICONQUESTION|MB_YESNO|MB_ICONSTOP '您確定要退出"Scale3DC2018"安裝程序?' IDNO CANCEL SendMessage $hwndparent ${WM_CLOSE} 0 0 CANCEL: Abort FunctionEnd ;處理頁面跳轉(zhuǎn)的命令 Function RelGotoPage IntCmp $R9 0 0 Move Move StrCmp $R9 "X" 0 Move StrCpy $R9 "120" Move: SendMessage $HWNDPARENT "0x408" "$R9" "" FunctionEnd Function onClickins ${NSD_GetText} $Txt_Browser $R0 ;獲得設(shè)置的安裝路徑 ;判斷目錄是否正確 ClearErrors CreateDirectory "$R0" IfErrors 0 +3 MessageBox MB_ICONINFORMATION|MB_OK "'$R0' 安裝目錄不存在,請重新設(shè)置。" Return StrCpy $INSTDIR $R0 ;保存安裝路徑 StrCpy $R9 1 ;Goto the next page Call RelGotoPage Abort FunctionEnd ;當(dāng)單擊自定義安裝后隱藏和顯示一部分控件 Function onClickint ShowWindow $BGImage ${SW_HIDE} ShowWindow $Ckbox0 ${SW_HIDE} ShowWindow $Txt_Xllicense ${SW_HIDE} ShowWindow $Txt_Gracenote ${SW_HIDE} ShowWindow $Txt_ji ${SW_HIDE} ShowWindow $btn_in ${SW_HIDE} ShowWindow $btn_ins ${SW_HIDE} ShowWindow $BGImage1 ${SW_SHOW} ShowWindow $btn_instetup ${SW_SHOW} ShowWindow $btn_back ${SW_SHOW} ShowWindow $Ckbox1 ${SW_SHOW} ShowWindow $Ckbox2 ${SW_SHOW} ShowWindow $Ckbox3 ${SW_SHOW} ShowWindow $btn_Browser ${SW_SHOW} ShowWindow $Txt_Browser ${SW_SHOW} FunctionEnd ;點擊返回時隱藏顯示部分控件 Function onClickBack ShowWindow $BGImage1 ${SW_HIDE} ShowWindow $BGImage ${SW_SHOW} ShowWindow $Ckbox0 ${SW_SHOW} ShowWindow $Txt_Xllicense ${SW_SHOW} ShowWindow $Txt_Gracenote ${SW_SHOW} ShowWindow $Txt_ji ${SW_SHOW} ShowWindow $btn_in ${SW_HIDE} ShowWindow $btn_ins ${SW_HIDE} ShowWindow $btn_in ${SW_SHOW} ShowWindow $btn_ins ${SW_SHOW} ShowWindow $BGImage1 ${SW_HIDE} ShowWindow $btn_instetup ${SW_HIDE} ShowWindow $btn_back ${SW_HIDE} ShowWindow $Ckbox1 ${SW_HIDE} ShowWindow $Ckbox2 ${SW_HIDE} ShowWindow $Ckbox3 ${SW_HIDE} ShowWindow $btn_Browser ${SW_HIDE} ShowWindow $Txt_Browser ${SW_HIDE} FunctionEnd #------------------------------------------ #許可協(xié)議 #------------------------------------------ Function xllicense ShowWindow $Ckbox0 ${SW_HIDE} ShowWindow $Txt_Xllicense ${SW_HIDE} ShowWindow $Txt_Gracenote ${SW_HIDE} ShowWindow $Txt_ji ${SW_HIDE} ShowWindow $btn_in ${SW_HIDE} ShowWindow $btn_ins ${SW_HIDE} ShowWindow $rtf_License ${SW_SHOW} ShowWindow $btn_Licenseback ${SW_SHOW} ShowWindow $rtf_License ${SW_SHOW} FunctionEnd ;點擊協(xié)議下方的按鈕執(zhí)行 Function Licenseback ShowWindow $Ckbox0 ${SW_SHOW} ShowWindow $Txt_Xllicense ${SW_SHOW} ShowWindow $Txt_Gracenote ${SW_SHOW} ShowWindow $Txt_ji ${SW_SHOW} ShowWindow $btn_in ${SW_SHOW} ShowWindow $btn_ins ${SW_SHOW} ShowWindow $btn_ins ${SW_SHOW} ShowWindow $btn_Licenseback ${SW_HIDE} ShowWindow $rtf_License ${SW_HIDE} ShowWindow $Rtf_Gracenote ${SW_HIDE} FunctionEnd Function Gracenote ShowWindow $Ckbox0 ${SW_HIDE} ShowWindow $Txt_Xllicense ${SW_HIDE} ShowWindow $Txt_Gracenote ${SW_HIDE} ShowWindow $rtf_License ${SW_HIDE} ShowWindow $Txt_ji ${SW_HIDE} ShowWindow $btn_in ${SW_HIDE} ShowWindow $btn_ins ${SW_HIDE} ShowWindow $btn_Licenseback ${SW_SHOW} ShowWindow $rtf_Gracenote ${SW_SHOW} FunctionEnd ;點擊第三方協(xié)議下的確定按鈕執(zhí)行 Function Gracenoteback ShowWindow $rtf_License ${SW_HIDE} ShowWindow $Rtf_Gracenote ${SW_HIDE} ShowWindow $btn_Gracenoteback ${SW_HIDE} ShowWindow $Ckbox0 ${SW_SHOW} ShowWindow $Txt_Xllicense ${SW_SHOW} ShowWindow $Txt_Gracenote ${SW_SHOW} ShowWindow $Txt_ji ${SW_SHOW} ShowWindow $btn_in ${SW_SHOW} ShowWindow $btn_ins ${SW_SHOW} ShowWindow $btn_ins ${SW_SHOW} FunctionEnd Function onClickmusic ExecShell "open" "http://www.nbzycn.com" FunctionEnd #------------------------------------------ #是否選中許可協(xié)議判斷 #------------------------------------------ Function Chklicense Pop $Ckbox0 ${NSD_GetState} $Ckbox0 $0 ${If} $0 == 1 EnableWindow $btn_ins 1 ;對指定的窗口或控件是否允許鍵入0禁止 EnableWindow $btn_in 1 ${Else} EnableWindow $btn_ins 0 ;對指定的窗口或控件是否允許鍵入0禁止 EnableWindow $btn_in 0 ${EndIf} FunctionEnd #-------------------------------------------------------- # 路徑選擇按鈕事件,打開Windows系統(tǒng)自帶的目錄選擇對話框 #-------------------------------------------------------- Function onClickSelectPath ${NSD_GetText} $Txt_Browser $0 nsDialogs::SelectFolderDialog "請選擇 ${PRODUCT_NAME} 安裝目錄:" "$0" Pop $0 ${IfNot} $0 == error ${NSD_SetText} $Txt_Browser $0 ${EndIf} FunctionEnd ;立即體驗檢測 Function onClickexpress ${NSD_GetState} $Ckbox4 $0 ${If} $0 == 1 ;MessageBox MB_OK '選中:立即啟動Scale3DC稱重軟件' ;判斷選中時的操作,實際代碼需要自己修改 ExecShell "open" "$INSTDIR\Scale3DC.exe" ${EndIf} ;${NSD_GetState} $Ckbox5 $0 ; ${if} $0 = 1 ; MessageBox MB_OK '選中:推薦安裝QQ游戲' ;判斷選中時的操作,實際代碼需要自己修改 ; ${EndIf} ;Exec "$INSTDIR\qqmusic.exe" ;這個不需要選中也操作,即運行QQ音樂 ;MessageBox MB_OK '運行Scale3DC稱重軟件' ;ExecShell "open" "$INSTDIR\Scale3DC.exe" SendMessage $hwndparent ${WM_CLOSE} 0 0 FunctionEnd ;完成頁面完成按鈕 Function onClickend ${NSD_GetState} $Ckbox4 $0 ${If} $0 == 1 MessageBox MB_OK '選中:開機自動啟動' ;判斷選中時的操作,實際代碼需要自己修改 ExecShell "open" "$INSTDIR\Scale3DC.exe" ${EndIf} ;${NSD_GetState} $Ckbox5 $0 ; ${if} $0 = 1 ; MessageBox MB_OK '選中:推薦安裝QQ游戲' ;判斷選中時的操作,實際代碼需要自己修改 ; ${EndIf} ;ExecShell "open" "$INSTDIR\Scale3DC.exe" SendMessage $hwndparent ${WM_CLOSE} 0 0 FunctionEnd Section "Uninstall" ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\*.*" Delete "$DESKTOP\Scale3DC稱重軟件.lnk" Delete "$DESKTOP\ZYCOMM串口調(diào)試工具v4.0.lnk" RMDir /r "$INSTDIR" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey /ifempty HKLM "${PRODUCT_UNINST_KEY}" SectionEnd
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。