home *** CD-ROM | disk | FTP | other *** search
- ; Routine to add a file's date to the title bar.
-
- ; By Larry Margolis
-
- defload
- if leftstr(.filename,1)='.' then return; endif -- EPM temp. file
- filename = .filename\0
- DirHandle = atoi(1)
- attribute = atoi(0) -- 0=normal; no subdirectories, hidden or system
- resultbuf = copies(' ',255)
- resultbuflen = atoi(255)
- searchcount = atoi(1)
- reserved = atol(0)
-
- rc = dynalink('DOSCALLS', -- dynamic link library name
- '#64', -- ordinal value for DosFindFirst
- selector(filename) || -- string selector
- offset(filename) || -- string offset
- selector(DirHandle) || -- string selector
- offset(DirHandle) || -- string offset
- attribute ||
- selector(resultbuf) || -- string selector
- offset(resultbuf) || -- string offset
- resultbuflen ||
- selector(searchcount) || -- string selector
- offset(searchcount) || -- string offset
- reserved )
- if rc then
- if rc=18 then -- RC 18 = no more files
- .titletext = .filename '(new file)'
- else
- sayerror 'Error' rc 'from DosFindFirst.'
- endif
- return
- endif
- date = ltoa(substr(resultbuf,9,2)\0\0,10); time = ltoa(substr(resultbuf,11,2)\0\0,10)
- year = date % 512; date = date // 512
- month = date % 32; day = date // 32 % 1 -- %1 to drop fraction.
- date = year+1980'/'rightstr(month,2,0)'/'rightstr(day,2,0)
- hour = time % 2048; time = time // 2048
- min = time % 32; sec = time // 32 * 2 % 1
- time = hour':'rightstr(min,2,0)':'rightstr(sec,2,0)
- .titletext = .filename '('date time')'
-