Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iAppsMail - Memory Usage Problem
#24
Use GetFileInfo or Dir.FileSize. Or calculate in callback function, like in example.

Code:
Copy      Help
out
ARRAY(POSTFIELD) a.create(2); int i
a[i].name="exe1"; a[i].value="$system$\notepad.exe"; a[i].isfile=1; i+1
a[i].name="exe2"; a[i].value="$system$\calc.exe"; a[i].isfile=1; i+1

type PFD_CALLBACK hwnd nbFilesTotal
PFD_CALLBACK d

d.hwnd=ShowDialog("" 0 0 0 1)
Http h.Connect("www.quickmacros.com"); str r
if(!h.PostFormData("form.php" a r "" &PostFormData_progress_dialog2 &d)) end "failed"
out "Total size of uploaded files is %i KB" d.nbFilesTotal/1024
out r

DestroyWindow d.hwnd

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 222 80 "Form"
;2 Button 0x54030000 0x4 168 62 48 14 "Cancel"
;3 msctls_progress32 0x54000000 0x0 30 6 186 12 ""
;4 msctls_progress32 0x54000000 0x0 30 24 186 12 ""
;5 Static 0x54000000 0x0 4 6 24 12 "Total"
;6 Static 0x54000000 0x0 4 24 22 12 "File"
;7 Static 0x54000000 0x0 4 42 212 16 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010900 "" ""

Function PostFormData_progress_dialog2
Code:
Copy      Help
function# action nbAll nbRead $_file nbAllF nbReadF PFD_CALLBACK&d
;out "%i %i %s %i %i" nbAll nbRead _file nbAllF nbReadF

if(!IsWindow(d.hwnd)) ret 1

def PBM_SETPOS (WM_USER+2)
SendMessage id(3 d.hwnd) PBM_SETPOS nbRead*100L/nbAll 0
lpstr st
sel action
,case 0 st="Sending data..."
,case 1
,st=_file
,SendMessage id(4 d.hwnd) PBM_SETPOS nbReadF*100L/nbAllF 0
,if(nbReadF=nbAllF) d.nbFilesTotal+nbAllF
,case 2 st="All data sent"
,case 3 st="Receiving response..."
,case 4 st="Finished"
SetDlgItemText d.hwnd 7 st
0


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)