>#DEFINE MAX_INT 0x100000000 >PROTECTED pnFileSize >LOCAL ppFileInformation > >ppFileInformation = REPLICATE(CHR(0), 53) > >IF GetFileAttributesEx (tcFile, 0, @ppFileInformation) != 0 > tcFileSizeHi = SUBSTR( ppFileInformation, 29, 4 ) > tcFileSizeLo = SUBSTR( ppFileInformation, 33, 4 ) > > threadFreeLo = THIS.buf2dword ( tcFileSizeLo ) > threadFreeHi = THIS.buf2dword ( tcFileSizeHi ) > This.pnFileSize = THIS.getLargeInt( threadFreeLo, threadFreeHi ) >ENDIF > >FUNCTION getFileSize() > RETURN This.pnFileSize >ENDFUNC > >PROTECTED FUNCTION getLargeInt (tnlowValue, tnhighValue ) > RETURN MAX_INT * tnhighValue + tnlowValue >ENDFUNC > >>
>loFileAttributes = CreateObject ("fileAttributes", tcFile ) >? "File Size = ", loFileAttributes.getFileSize() >>
> >SET CLASSLIB TO ..\classes\mathconversions.vcx >This.oMath = CREATEOBJECT( 'mathconversions' ) > >LOCAL lcFileSizeHi, lcFileSizeLo >lcFileInformation = REPLICATE(CHR(0), WIN32_FILE_ATTRIBUTE_DATA_LEN ) >&& NULL terminated buffer that emulates the WIN32_FILE_ATTRIBUTE_DATA Structure > >IF GetFileAttributesEx( tcFile, 0, @lcFileInformation ) != 0 > > lcFileSizeHi = SUBSTR( lcFileInformation, 29, 4 ) > lcFileSizeLo = SUBSTR( lcFileInformation, 33, 4 ) > > lnFileSizeLo = This.oMath.buf2dword( lcFileSizeLo ) > lnFileSizeHi = This.oMath.buf2dword( lcFileSizeHi ) > lnFileSize = THIS.oMath.getLargeInt( lnFileSizeHi, lnFileSizeLo ) > This.pnFileSize = THIS.oMath.getLargeInt( lnFileSizeHi, lnFileSizeLo ) > >ENDIF > >getFilesize method: >RETURN This.pnFileSize >>
>SET CLASSLIB TO fileattributes >oFile = CREATEOBJECT( 'getfileattributes', 'filename here' ) > >?oFile.getFilesize() > >>