115浏览器 NSIS源代码 A版
文章转自王牌软件
站长推荐:NSetup一键部署软件
一键式完成美化安装包制作,自动增量升级,数据统计,数字签名。应对各种复杂场景,脚本模块化拆分,常规复杂的脚本代码,图形化设置。无需专业的研发经验,轻松完成项目部署。(www.nsetup.cn)
只回答业务咨询
站长推荐:NSetup一键部署软件
一键式完成美化安装包制作,自动增量升级,数据统计,数字签名。应对各种复杂场景,脚本模块化拆分,常规复杂的脚本代码,图形化设置。无需专业的研发经验,轻松完成项目部署。(www.nsetup.cn)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
/* Compile the script to use the Unicode version of NSIS The producers:surou */ ;ExecShell taskbarunpin "$DESKTOP\${PRODUCT_NAME}.lnk"是删除任务栏图标 ;安装包 解压空白 !system '>blank set/p=MSCF<nul' !packhdr temp.dat 'cmd /c Copy /b temp.dat /b +blank&&del blank' ;定义变量 Var Dialog Var MessageBoxHandle Var installPath Var FreeSpaceSize ; 安装程序初始定义常量 !define PRODUCT_VERSION "2016.01.11.000" !define MAIN_APP_NAME "GoogleTranslate.exe" !define PRODUCT_NAME "Google Translate" !define PRODUCT_NAME_EN "Google Translate" !define PRODUCT_PUBLISHER "aceui" !define PRODUCT_WEB_SITE "http://www.aceui.cn" !define PRODUCT_2345WEB_SITE "http://www.2345.com/?k652511569" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_NAME}" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_AUTORUN_KEY "Software\Microsoft\Windows\CurrentVersion\Run" !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define MUI_ICON "resouce\115Browser\app.ico" !define MUI_UNICON "resouce\115Browser\app.ico" !define UNINSTALL_DIR "$TEMP\ACEUI\aceuiStep" ;刷新关联图标 !define SHCNE_ASSOCCHANGED 0x08000000 !define SHCNF_IDLIST 0 ; 安装不需要重启 !define MUI_FINISHPAGE_NOREBOOTSUPPORT ; 设置文件覆盖标记 SetOverwrite on ; 设置压缩选项 SetCompress auto ; 选择压缩方式 SetCompressor /SOLID lzma SetCompressorDictSize 32 ; 设置数据块优化 SetDatablockOptimize on ; 设置在数据中写入文件时间 SetDateSave on ;设置Unicode 编码 3.0以上版本支持 Unicode false ; 是否允许安装在根目录下 AllowRootDirInstall false Name "${PRODUCT_NAME}" OutFile "output\115Browser.exe" InstallDir "$PROGRAMFILES\Google Translate" InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" ;Request application privileges for Windows Vista RequestExecutionLevel admin ;文件版本声明-开始 VIProductVersion ${PRODUCT_VERSION} VIAddVersionKey /LANG=2052 "ProductName" "Google Translate" VIAddVersionKey /LANG=2052 "Comments" "Google Translate" VIAddVersionKey /LANG=2052 "CompanyName" "Aceui" VIAddVersionKey /LANG=2052 "LegalTrademarks" "Google Translate" VIAddVersionKey /LANG=2052 "LegalCopyright" "Google Translate." VIAddVersionKey /LANG=2052 "FileDescription" "Google Translate install" VIAddVersionKey /LANG=2052 "FileVersion" ${PRODUCT_VERSION} ;文件版本声明-结束 ; 引入的头文件 !include "MUI.nsh" !include "FileFunc.nsh" ;Languages !insertmacro MUI_LANGUAGE "SimpChinese" ;初始化数据 ; 安装和卸载页面 Page custom InstallProgress Page instfiles "" InstallShow UninstPage custom un.UninstallProgress UninstPage instfiles "" un.UninstallNow Function .onInit ;创建互斥防止重复运行 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "ACEUIInstall") i .r1 ?e' Pop $R0 StrCmp $R0 0 +3 MessageBox MB_OK|MB_ICONEXCLAMATION "有一个 Google Translate 安装向导已经运行!" Abort KillProcDLL::KillProc "${MAIN_APP_NAME}" ;强制结束进程 SetOutPath "${UNINSTALL_DIR}" File /r /x *.db ".\resouce\115Browser\*.*" ;初始化数据 安装目录 ReadRegStr $installPath HKLM "SOFTWARE\aceui\115browser" "installDir" ${If} $installPath == "" ;初始化安装位置 $APPDATA StrCpy $installPath "$PROGRAMFILES\Google Translate" ${EndIf} FunctionEnd Function InstallProgress nsSkinEngine::InitNSISSkinEngine /NOUNLOAD "${UNINSTALL_DIR}" "InstallPackages.xml" "WizardTab" "false" "115浏览器" "7B4D2AD97EC46776D7504B1F501B17483E5EFD52B3BA9E8BE9D6401E4F742E19B822CC7DDF6FC224A5D8AAFB9FFC899B" "app.ico" "true" Pop $Dialog ;初始化MessageBox窗口 nsSkinEngine::InitNSISMessageBox "MessageBox.xml" "TitleLab" "TextLab" "CloseBtn" "YESBtn" "NOBtn" Pop $MessageBoxHandle ;关闭按钮绑定函数 nsSkinEngine::FindControl "InstallTab_sysCloseBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have InstallTab_sysCloseBtn" ${Else} GetFunctionAddress $0 OnInstallCancelFunc nsSkinEngine::OnControlBindNSISScript "InstallTab_sysCloseBtn" $0 ${EndIf} ;------------------------安装界面----------------------- ;安装路径编辑框设定数据 nsSkinEngine::FindControl "InstallTab_InstallFilePath" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have InstallTab_InstallFilePath" ${Else} GetFunctionAddress $0 OnTextChangeFunc nsSkinEngine::OnControlBindNSISScript "InstallTab_InstallFilePath" $0 nsSkinEngine::SetControlData "InstallTab_InstallFilePath" $installPath "text" Call OnTextChangeFunc ${EndIf} ;安装路径浏览按钮绑定函数 nsSkinEngine::FindControl "InstallTab_SelectFilePathBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have InstallTab_SelectFilePathBtn button" ${Else} GetFunctionAddress $0 OnInstallPathBrownBtnFunc nsSkinEngine::OnControlBindNSISScript "InstallTab_SelectFilePathBtn" $0 ${EndIf} ;展开自定义选项 nsSkinEngine::FindControl "CustomOptionsCheckBox" ${If} $0 == "-1" MessageBox MB_OK "Do not have CustomOptionsCheckBox" ${Else} GetFunctionAddress $0 OnCheckChanged nsSkinEngine::OnControlBindNSISScript "CustomOptionsCheckBox" $0 ${EndIf} ;是否同意 nsSkinEngine::FindControl "acceptCheckBox" ${If} $0 == "-1" MessageBox MB_OK "Do not have acceptCheckBox" ${Else} GetFunctionAddress $0 acceptCheckChangedFunc nsSkinEngine::OnControlBindNSISScript "acceptCheckBox" $0 ${EndIf} ;使用协议 nsSkinEngine::FindControl "acceptBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have acceptBtn button" ${Else} GetFunctionAddress $0 acceptPageFunc nsSkinEngine::OnControlBindNSISScript "acceptBtn" $0 ${EndIf} ;使用协议确定 nsSkinEngine::FindControl "okAcceptBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have okAcceptBtn button" ${Else} GetFunctionAddress $0 acceptOkFunc nsSkinEngine::OnControlBindNSISScript "okAcceptBtn" $0 ${EndIf} ;开始安装按钮绑定函数 nsSkinEngine::FindControl "InstallBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have InstallBtn button" ${Else} GetFunctionAddress $0 InstallPageFunc nsSkinEngine::OnControlBindNSISScript "InstallBtn" $0 ${EndIf} ;--------------------------------------完成页面---------------------------------- nsSkinEngine::FindControl "CompleteTab_CompleteBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have CompleteTab_CompleteBtn button" ${Else} GetFunctionAddress $0 OnCompleteBtnFunc nsSkinEngine::OnControlBindNSISScript "CompleteTab_CompleteBtn" $0 ${EndIf} ;--------------------------------------窗体显示----------------------------------- Call OnCheckChanged nsSkinEngine::SetControlData "defaultAppCheckBox" "true" "Checked" nsSkinEngine::SetControlData "acceptCheckBox" "true" "Checked" nsSkinEngine::SetControlData "deskShortCheckBox" "true" "Checked" nsSkinEngine::SetControlData "2345CheckBox" "true" "Checked" nsSkinEngine::SetControlData "autoCheckBox" "true" "Checked" nsSkinEngine::SetControlData "userFuckCheckBox" "true" "Checked" nsSkinEngine::RunNSISSkinEngine FunctionEnd Function OnNextBtnFunc nsSkinEngine::NSISSendMessage $Dialog WM_NSISNEXT FunctionEnd Function OnInstallCancelFunc nsSkinEngine::ExitNSISSkinEngine FunctionEnd Function UpdateFreeSpace ${GetRoot} $INSTDIR $0 StrCpy $1 "Bytes" System::Call kernel32::GetDiskFreeSpaceEx(tr0,*l,*l,*l.r0) ${If} $0 > 1024 ${OrIf} $0 < 0 System::Int64Op $0 / 1024 Pop $0 StrCpy $1 "KB" ${If} $0 > 1024 ${OrIf} $0 < 0 System::Int64Op $0 / 1024 Pop $0 StrCpy $1 "MB" ${If} $0 > 1024 ${OrIf} $0 < 0 System::Int64Op $0 / 1024 Pop $0 StrCpy $1 "GB" ${EndIf} ${EndIf} ${EndIf} StrCpy $FreeSpaceSize "$0$1" FunctionEnd Function FreshInstallDataStatusFunc ;更新磁盘空间文本显示 nsSkinEngine::FindControl "InstallTab_FreeSpace" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have InstallTab_FreeSpace" ${Else} nsSkinEngine::SetControlData "InstallTab_FreeSpace" $FreeSpaceSize "text" ${EndIf} ;路径是否合法(合法则不为0Bytes) ${If} $FreeSpaceSize == "0Bytes" nsSkinEngine::SetControlData "InstallTab_InstallBtn" "false" "enable" ${Else} nsSkinEngine::SetControlData "InstallTab_InstallBtn" "true" "enable" ${EndIf} FunctionEnd Function OnTextChangeFunc ; 改变可用磁盘空间大小 nsSkinEngine::GetControlData InstallTab_InstallFilePath "text" Pop $0 ;MessageBox MB_OK $0 StrCpy $INSTDIR $0 ;重新获取磁盘空间 Call UpdateFreeSpace Call FreshInstallDataStatusFunc FunctionEnd Function OnInstallPathBrownBtnFunc nsSkinEngine::GetControlData "InstallTab_InstallFilePath" "text" ; Pop $installPath nsSkinEngine::SelectFolderDialog "请选择文件夹" $installPath Pop $installPath StrCpy $0 $installPath ${If} $0 == "-1" ${Else} StrCpy $INSTDIR "$installPath\${PRODUCT_NAME_EN}" ;设置安装路径编辑框文本 nsSkinEngine::FindControl "InstallTab_InstallFilePath" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have Wizard_InstallPathBtn4Page2 button" ${Else} ;nsSkinEngine::SetText2Control "InstallTab_InstallFilePath" $installPath StrCpy $installPath $INSTDIR nsSkinEngine::SetControlData "InstallTab_InstallFilePath" $installPath "text" ${EndIf} ${EndIf} ;重新获取磁盘空间 Call UpdateFreeSpace Call FreshInstallDataStatusFunc FunctionEnd Function OnCheckChanged nsSkinEngine::GetControlData "CustomOptionsCheckBox" "Checked" ; Pop $0 ${If} $0 == "1" nsSkinEngine::NSISResize "445" "608" nsSkinEngine::SetControlData "customVer" "true" "visible" ${Else} nsSkinEngine::NSISResize "445" "462" nsSkinEngine::SetControlData "customVer" "false" "visible" ${EndIf} FunctionEnd Function acceptCheckChangedFunc nsSkinEngine::GetControlData "acceptCheckBox" "Checked" ; Pop $0 ${If} $0 == "1" nsSkinEngine::SetControlData "InstallBtn" "true" "enable" ${Else} nsSkinEngine::SetControlData "InstallBtn" "false" "enable" ${EndIf} FunctionEnd Function acceptPageFunc nsSkinEngine::SetControlData "windowbk" "1" "TabCurrentIndexInt" nsSkinEngine::ShowLicense "acceptInfo" "license.txt" FunctionEnd Function acceptOkFunc nsSkinEngine::SetControlData "windowbk" "0" "TabCurrentIndexInt" FunctionEnd Function InstallPageFunc nsSkinEngine::SetControlData "InstallTab_sysCloseBtn" "false" "enable" nsSkinEngine::NSISResize "445" "462" nsSkinEngine::SetControlData "customVer" "false" "visible" Call OnNextBtnFunc ;设置进度条 nsSkinEngine::SetControlData "CompleteTab_RunAppCheckBox" "true" "Checked" ;默认勾选运行程序 nsSkinEngine::FindControl "InstallProgressBar" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have InstallProgressBar" ${Else} nsSkinEngine::SetControlData "InstallProgressBar" "0" "ProgressInt" nsSkinEngine::SetControlData "progressText" "0%" "text" nsSkinEngine::NSISStopMsgLoop ${EndIf} FunctionEnd Function InstallShow nsSkinEngine::FindControl "InstallProgressBar" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have InstallProgressBar" ${Else} nsSkinEngine::NSISBindingProgress "InstallProgressBar" "progressText" ${EndIf} FunctionEnd Section InstallFiles SetOutPath "$INSTDIR" SetOverwrite ifnewer File /r "bin\*.*" SectionEnd Section RegistKeys WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\${MAIN_APP_NAME}" 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\${MAIN_APP_NAME},0" 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 CreateShorts WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" SetShellVarContext all ;创建开始菜单快捷方式 CreateDirectory "$SMPROGRAMS\Google Translate" CreateShortCut "$SMPROGRAMS\Google Translate\${PRODUCT_NAME}.lnk" "$INSTDIR\${MAIN_APP_NAME}" CreateShortCut "$SMPROGRAMS\Google Translate\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" CreateShortCut "$SMPROGRAMS\Google Translate\Uninstall.lnk" "$INSTDIR\uninst.exe" SetOverwrite ifnewer nsSkinEngine::GetControlData "deskShortCheckBox" "Checked" ; Pop $0 ${If} $0 == "1" ;创建桌面快捷方式 CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${MAIN_APP_NAME}" ${EndIf} /* CreateShortCut "$QUICKLAUNCH\${PRODUCT_NAME}.lnk" "$INSTDIR\${MAIN_APP_NAME}" System::Call 'shell32.dll::ShellExecute(i 0, t "taskbarpin", t "$QUICKLAUNCH\${PRODUCT_NAME}.lnk", i 0, i 0, i 0) i .r1 ?e' */ Call RefreshShellIcons SectionEnd Section Finish nsSkinEngine::SetControlData "InstallTab_sysCloseBtn" "true" "enable" nsSkinEngine::GetControlData "2345CheckBox" "Checked" ; Pop $0 ${If} $0 == "1" ;设置浏览器首页 WriteRegStr HKCU "Software\Microsoft\Internet Explorer\Main" "Start Page" "${PRODUCT_2345WEB_SITE}" ${EndIf} SectionEnd Function OnCompleteBtnFunc nsSkinEngine::HideNSISSkinEngine nsSkinEngine::StopAnimationBkControl nsSkinEngine::GetControlData "autoCheckBox" "Checked" ; Pop $0 ${If} $0 == "1" WriteRegStr HKCU "${PRODUCT_AUTORUN_KEY}" "${PRODUCT_NAME}" "$INSTDIR\${MAIN_APP_NAME} -mini" ${EndIf} Exec '"$INSTDIR\${MAIN_APP_NAME}"' nsSkinEngine::ExitNSISSkinEngine "false" FunctionEnd Function un.accept nsSkinEngine::NSISSendMessage $Dialog WM_NSISOPENURL "http://www.aceui.cn/"; FunctionEnd ;----------------------------------------------------------------------------------------------------------------------------- Function un.onInit ;创建互斥防止重复运行 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "aceuiUnInstall") i .r1 ?e' Pop $R0 StrCmp $R0 0 +3 MessageBox MB_OK|MB_ICONEXCLAMATION "有一个 115浏览器 卸载向导已经运行!" Abort SetOutPath "${UNINSTALL_DIR}" File /r /x *.db ".\resouce\115Browser\*.*" KillProcDLL::KillProc "${MAIN_APP_NAME}" ;强制结束进程 FunctionEnd Function un.UninstallProgress nsSkinEngine::InitNSISSkinEngine /NOUNLOAD "${UNINSTALL_DIR}" "UninstallPackages.xml" "WizardTab" "false" "115浏览器" "7B4D2AD97EC46776D7504B1F501B17483E5EFD52B3BA9E8BE9D6401E4F742E19B822CC7DDF6FC224A5D8AAFB9FFC899B" "app.ico" "true" Pop $Dialog ;初始化MessageBox窗口 nsSkinEngine::InitNSISMessageBox "MessageBox.xml" "TitleLab" "TextLab" "CloseBtn" "YESBtn" "NOBtn" Pop $MessageBoxHandle ;关闭按钮绑定函数 nsSkinEngine::FindControl "sysCloseBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have sysCloseBtn" ${Else} GetFunctionAddress $0 un.OnUnInstallCancelFunc nsSkinEngine::OnControlBindNSISScript "sysCloseBtn" $0 ${EndIf} ;取消按钮绑定函数 nsSkinEngine::FindControl "cancelUninstallBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have cancelUninstallBtn" ${Else} GetFunctionAddress $0 un.OnUnInstallCancelFunc nsSkinEngine::OnControlBindNSISScript "cancelUninstallBtn" $0 ${EndIf} ;残忍卸载 okUninstallBtn nsSkinEngine::FindControl "okUninstallBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have okUninstallBtn" ${Else} GetFunctionAddress $0 un.UnInstallPageFunc nsSkinEngine::OnControlBindNSISScript "okUninstallBtn" $0 ${EndIf} ;卸载完成 completeBtn nsSkinEngine::FindControl "completeBtn" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have completeBtn" ${Else} GetFunctionAddress $0 un.OnCompleteBtnFunc nsSkinEngine::OnControlBindNSISScript "completeBtn" $0 ${EndIf} ;--------------------------------------窗体显示----------------------------------- nsSkinEngine::RunNSISSkinEngine FunctionEnd Function un.OnUnInstallCancelFunc nsSkinEngine::ExitNSISSkinEngine FunctionEnd Function un.OnNextBtnFunc nsSkinEngine::NSISSendMessage $Dialog WM_NSISNEXT FunctionEnd Function un.UnInstallPageFunc Call un.OnNextBtnFunc nsSkinEngine::NSISStopMsgLoop FunctionEnd Function un.UninstallNow nsSkinEngine::FindControl "UnInstallProgressBar" Pop $0 ${If} $0 == "-1" MessageBox MB_OK "Do not have UnInstallProgressBar" ${Else} nsSkinEngine::NSISBindingProgress "UnInstallProgressBar" "progressText" ${EndIf} FunctionEnd Section "Uninstall" # 设置为当前用户 SetShellVarContext current # 设置为所有用户 SetShellVarContext all Delete "$SMPROGRAMS\Google Translate\*.lnk" Delete "$SMPROGRAMS\Google Translate\Uninstall.lnk" Delete "$SMPROGRAMS\Google Translate\Website.lnk" Delete "$SMPROGRAMS\Google Translate\${PRODUCT_NAME}.lnk" Delete "$DESKTOP\${PRODUCT_NAME}.lnk" RMDir /r /REBOOTOK "$SMPROGRAMS\Google Translate" RMDir /r /REBOOTOK "$INSTDIR" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Google Translate" DeleteRegValue HKCU "${PRODUCT_AUTORUN_KEY}" "${PRODUCT_NAME}" SectionEnd Function un.OnCompleteBtnFunc nsSkinEngine::HideNSISSkinEngine ;Call un.SendStatistics ;Call un.DeleteRegKey ;发送完统计再调用删除key,因为发送可能需要某些键值 nsSkinEngine::ExitNSISSkinEngine FunctionEnd ;刷新关联图标 Function RefreshShellIcons System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v \ (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' FunctionEnd Function .onInstSuccess FunctionEnd |
学习日记,兼职软件设计,软件修改,毕业设计。
本文出自 学习日记,转载时请注明出处及相应链接。
本文永久链接: https://www.softwareace.cn/?p=1426
一条评论
帮你顶,人还是厚道点好