09-12-2006, 02:11 PM
Methodology:
---------------
DL - Dialog with parent window handle of the main window
ProcessDL - Performs Download using IntGetFile
TrackDL - Calculates string size using .len and performs percentage calculations
I would appreciate if you could let me know of a more efficient way.
---------------
DL - Dialog with parent window handle of the main window
ProcessDL - Performs Download using IntGetFile
str+ DL_Data=""
int+ DL_Complete=0
mac "TrackDL" "" filename filesize
IntGetFile(filepath DL_Data 0)
DL_Complete=1
err+
DL_Complete=-1TrackDL - Calculates string size using .len and performs percentage calculations
function $filename #filesize
str+ DL_Data
DL_Data.escape
FLOAT tsize = filesize - DL_Data.len
FLOAT fperc
int perc
str downloaded
REPEAT
rep
if DL_Complete = 1
ret
DL_Data.escape
int size = DL_Data.len
FLOAT fsize = size
if size > 1048576
downloaded.format("%.02f MB" fsize/1048576)
else if size > 1024
downloaded.format("%.02f KB" fsize/1024)
else
downloaded.format("%d bytes" size)
if fsize != 0
fperc = (fsize*100)/tsize
perc = fperc
_s = "Downloading "
_s + filename
_s + "... ["
_s + perc
_s + "%]"
_s.setwintext(id(5 dl_hwnd))
_s = downloaded
_s + " complete"
_s.setwintext(id(6 dl_hwnd))
SendMessage dl_hpb PBM_SETPOS perc 0
0.5
err+
out "Download Track Error! - Tracker Restarted ..."
goto REPEATI would appreciate if you could let me know of a more efficient way.
