簡體   English   中英

NSIS異步文件下載和自定義進度欄

[英]NSIS async file download and custom progress bar

它是否具有NSIS插件或內置功能來異步下載文件並使用下載進度更新自定義進度欄(使用nsDialogs創建)?

您可以使用INetBgDl插件在后台下載文件並設計自己的UI:

!include nsDialogs.nsh
!include LogicLib.nsh
Var hInfo
Var hPBar

Function myTimer
InetBgDL::GetStats
${If} $2 = 0
    ${NSD_KillTimer} myTimer
    ${NSD_SetText} $hInfo "Completed. (Status=$0)"
    SendMessage $hPBar ${PBM_SETRANGE32} 0 100
    SendMessage $hPBar ${PBM_SETPOS} 100 0
    Return
${EndIf}
IntOp $2 $2 + $1
StrCmp $4 "" 0 +2
StrCpy $4 "?"
${NSD_SetText} $hInfo "Status=$0$\nCompleted $1 of $2 files$\nDownloaded $3 of $4 bytes"
SendMessage $hPBar ${PBM_SETRANGE32} 0 $4
SendMessage $hPBar ${PBM_SETPOS} $3 0
FunctionEnd

Function myPage
nsDialogs::Create 1018
Pop $0

${NSD_CreateLabel} 0 0 100% 50% "Starting download..."
Pop $hInfo

${NSD_CreateProgressBar} 0 55% 100% 10u ""
Pop $hPBar

${NSD_CreateTimer} myTimer 1000
InetBgDL::Get /RESET "https://download.mozilla.org/?product=firefox-41.0.2-SSL&os=win&lang=en-US" "$PluginsDir\ff.exe" /END

nsDialogs::show
${NSD_KillTimer} myTimer
FunctionEnd

Page Custom myPage
Page InstFiles

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM