no creo, por donde vivo tienden a tirar balazos al aire y cuidado!¡... al fin y al cabo siempre se termina festejando algo ese dia, aunq ue no sea lo que se marca en la fecha!¡
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
Option Explicit
Private Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias "GetDiskFreeSpaceExA" _
(ByVal lpRootPathName As String, _
lpFreeBytesAvailableToCaller As Currency, _
lpTotalNumberOfBytes As Currency, _
lpTotalNumberOfFreeBytes As Currency) As Long
Private Sub Form_Load()
Dim r As Long, BytesFreeToCalller As Currency, TotalBytes As Currency
Dim TotalFreeBytes As Currency, TotalBytesUsed As Currency
Const RootPathName$ = "c:\"
Call GetDiskFreeSpaceEx(RootPathName, BytesFreeToCalller, TotalBytes, TotalFreeBytes)
Me.AutoRedraw = True
Me.Cls
Me.Print " Datos del Disco " & RootPathName
Me.Print "Capasidad Total:"
Me.Print ShowPrintForm(GetExpBytes(TotalBytes * 10000, 2))
Me.Print
Me.Print "Espacio Libre en " & RootPathName
Me.Print ShowPrintForm(GetExpBytes(TotalFreeBytes * 10000, 2))
Me.Print
Me.Print "Bytes Disponibles en " & RootPathName
Me.Print ShowPrintForm(GetExpBytes(BytesFreeToCalller * 10000, 2))
Me.Print
Me.Print "Espacio Utilizado en " & RootPathName
Me.Print ShowPrintForm(GetExpBytes((TotalBytes - TotalFreeBytes) * 10000, 2))
End Sub
Private Function GetExpBytes(ByVal vVal As Currency, Optional Redondear As Long = -1) As Currency()
Dim TmpArr() As Currency
Dim PtrArr&
ReDim TmpArr(PtrArr&)
TmpArr(PtrArr&) = vVal
Do Until Val(TmpArr(PtrArr&) - 100) < 0
PtrArr& = PtrArr& + 1
ReDim Preserve TmpArr(PtrArr&)
If Redondear < 0 Then
TmpArr(PtrArr&) = TmpArr(PtrArr& - 1) / 1024
Else
TmpArr(PtrArr&) = Round(TmpArr(PtrArr& - 1) / 1024, Redondear)
End If
Loop
GetExpBytes = TmpArr()
End Function
Private Function ShowPrintForm(ByRef RefCol() As Currency, Optional StrAbrev$ = "KMGT", Optional Sep$ = vbCrLf) As String
If (Not RefCol) = -1 Then Exit Function
Dim vByte(3) As Byte ' // Index:QueCosa? --> 0:LBound(); 1:Len(); 2:Ubound(): 3:IndexFor
vByte(0) = LBound(RefCol) + 0
ShowPrintForm = RefCol(vByte(0)) & " Bytes"
vByte(1) = Len(StrAbrev$) + 0
vByte(2) = UBound(RefCol) + 0
If vByte(2) > vByte(1) Then vByte(2) = vByte(1)
For vByte(3) = vByte(0) + 1 To vByte(2)
ShowPrintForm = ShowPrintForm & Sep$ & RefCol(vByte(3)) & " " & Mid$(StrAbrev$, vByte(3), 1) & "Bytes"
Next
End Function