Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IntGetFile Multiple File Progress
#2
Function dialog_download_multiple_progress
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "5 3"
str e5 lb3
e5="www.quickmacros.com"
lb3=
;images/ss/qm.png
;images/ss/debug.png
;com/winapi2.zip
str-- t_files; t_files=lb3

if(!ShowDialog("dialog_download_multiple_progress" &dialog_download_multiple_progress &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;6 Static 0x54000000 0x0 2 6 18 12 "Site"
;5 Edit 0x5C030080 0x200 22 4 196 14 ""
;7 Static 0x54000000 0x0 2 24 18 12 "Files"
;3 ListBox 0x5C230101 0x200 22 22 198 74 ""
;4 msctls_progress32 0x54030000 0x0 42 100 178 13 ""
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;8 Static 0x54000000 0x0 2 100 36 13 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030300 "*" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,PostMessage hDlg WM_APP 0 0
,case WM_APP goto g1
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
;g1
Http http.Connect(_s.getwintext(id(5 hDlg)))
http.SetProgressCallback(&DDMP_Callback hDlg)
str sf sd; int i hlb(id(3 hDlg))
foreach sf t_files
,LB_SelectItem(hlb i) ; i+1
,if !http.Get(sf sd 32)
,,if(http.lasterror~"cancel") ret
,,sel(mes(F"Failed to download '{sf}'. Error:  {http.lasterror}[][]Continue?" "" "YN")) case 'Y' continue; case else break
,;out sd.len
opt waitmsg 1; 0.5; clo hDlg

Function DDMP_Callback
Code:
Copy      Help
;/
function# nbAll nbRead str&s hDlg
;out nbRead
if(!IsWindowVisible(hDlg)) ret 1 ;;Cancel
if(nbRead=0) _s.format("%i KB" nbAll/1024); _s.setwintext(id(8 hDlg))
SendMessage id(4 hDlg) PBM_SETPOS MulDiv(nbRead 100 nbAll) 0


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)