Visual Basic - Obtener Tamaño de fichero

Life is soft - evento anual de software empresarial
 
Vista:

Obtener Tamaño de fichero

Publicado por Jose (93 intervenciones) el 04/06/2004 12:22:53
Hola!

¿Cómo puedo obtener el tamaño de un determinado fichero desde vb 6.0?

Un saludo y muchas gracias de antemano.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Obtener Tamaño de fichero

Publicado por skrank (99 intervenciones) el 06/06/2004 17:38:30
A ver si el ejemplo te sirve. No es mio, lo he pillado de internet
' Example by AKriLium-Death ([email protected])
' Visit his site at http://rift.zeloop.com
'Este proyecto necesita
' -Un Command Button (Command1)
' -Un CommonDialog (CommonDialog1)
' -Un Label (Label1)
Private Const OF_READ = &H0&
Private Declare Function lOpen Lib "kernel32" Alias "_lopen" (ByVal lpPathName As String, ByVal iReadWrite As Long) As Long
Private Declare Function lclose Lib "kernel32" Alias "_lclose" (ByVal hFile As Long) As Long
Private Declare Function GetFileSize Lib "kernel32" (ByVal hFile As Long, lpFileSizeHigh As Long) As Long
Dim lpFSHigh As Long
Public Sub GetInfoF(FilePath As String)
Dim Pointer As Long, sizeofthefile As Long
Pointer = lOpen(FilePath, OF_READ)
'Longitud del archivo
sizeofthefile = GetFileSize(Pointer, lpFSHigh)
Label1.Caption = sizeofthefile & " bytes"
lclose Pointer
End Sub
Private Sub command1_Click()
CommonDialog1.ShowOpen
GetInfoF CommonDialog1.FileName
End Sub
Private Sub Form_Load()
With CommonDialog1
.DialogTitle = "Select a file"
.Filter = "All the files|*.*"
End With
Command1.Caption = "Select a file"
End Sub
Chao
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar