translates to:Code:BOOL GetFileSizeEx( [in] HANDLE hFile, [out] PLARGE_INTEGER lpFileSize );
However you can get the file size without opening the file first:Code:Private Enum BOOL APIFALSE APITRUE End Enum Private Type LARGE_INTEGER LowPart As Long HighPart As Long End Type Private Declare Function GetFileSizeEx Lib "kernel32" (ByVal hFile As Long, lpFileSize As LARGE_INTEGER) As BOOL
Code:Public Function FileSize(sPath As String) As Currency Dim FileAttributeData As WIN32_FILE_ATTRIBUTE_DATA, cFileSizeLow As Currency, cFileSizeHigh As Currency Const cMaxInt As Currency = 2 ^ 32 If GetFileAttributesExW(StrPtr(sPath), 0, VarPtr(FileAttributeData)) Then With FileAttributeData If .nFileSizeLow < 0 Then cFileSizeLow = .nFileSizeLow + cMaxInt Else cFileSizeLow = .nFileSizeLow If .nFileSizeHigh < 0 Then cFileSizeHigh = .nFileSizeHigh + cMaxInt Else cFileSizeHigh = .nFileSizeHigh End With FileSize = cFileSizeLow + cFileSizeHigh * cMaxInt End If End Function




Reply With Quote