来自群友cy , 看代码
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function GetFileSizeEx Lib "kernel32.dll" (ByVal hFile As Long, ByRef lpFileSize As Currency) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Function GetBigFileLen(ByVal FileName As String) As Currency
Dim hFile As Long, nFileLen As Currency
hFile = CreateFile(FileName, 8, 1, 0, 3, 0, 0)
If hFile <> -1 Then
If GetFileSizeEx(hFile, nFileLen) = 1 Then
nFileLen = nFileLen * 10000
End If
CloseHandle (hFile)
GetBigFileLen = nFileLen
Else
GetBigFileLen = -1
End If
End Function
Private Sub Command1_Click()
Print GetBigFileLen("E:\back10.21.rar")
End Sub
Views: 18