07-02-2011, 05:57 AM
Function dialog_download_multiple_progress
Function DDMP_Callback
\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 hDlgFunction DDMP_Callback
