Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iAppsMail - Memory Usage Problem
#3
Methodology:
---------------

DL - Dialog with parent window handle of the main window

ProcessDL - Performs Download using IntGetFile

Code:
Copy      Help
str+ DL_Data=""
             int+ DL_Complete=0
             mac "TrackDL" "" filename filesize
             IntGetFile(filepath DL_Data 0)
             DL_Complete=1

             err+
                          DL_Complete=-1

TrackDL - Calculates string size using .len and performs percentage calculations
Code:
Copy      Help
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 REPEAT



I would appreciate if you could let me know of a more efficient way.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)