Hola,
En el programa Sentinel que está en Gratisware, tienes cómo hacerlo usando
la DLL StKit416.dll que se incluye con el VB.
La declaración es:
'Función para leer el espacio libre de los discos (del Setup1 de Visual
Basic
Private Declare Function DiskSpaceFree Lib "StKit416.dll" () As Long
Y la forma de usarla es:
'-----------------------------------------------------------
' FUNCTION: GetDiskSpaceFree
' Get the amount of free disk space for the specified drive
'
' IN: [strDrive] - drive to check space for
'
' Returns: Amount of free disk space, or -1 if an error occurs
'-----------------------------------------------------------
'
Function GetDiskSpaceFree(ByVal strDrive As String) As Long
Dim strCurDrive As String
Dim lDiskFree As Long
Const gstrCOLON = ":"
On Local Error Resume Next
'
'Save the current drive
'
strCurDrive = Left$(CurDir$, 2)
'
'Fixup drive so it includes only a drive letter and a colon
'
If InStr(strDrive, gstrCOLON) = 0 Or Len(strDrive) > 2 Then
strDrive = Left$(strDrive, 1) & gstrCOLON
End If
'
'Change to the drive we want to check space for. The DiskSpaceFree()
API
'works on the current drive only.
'
ChDrive strDrive
'
'If we couldn't change to the request drive, it's an error, otherwise
return
'the amount of disk space free
'
If Err <> 0 Or (strDrive <> Left$(CurDir$, 2)) Then
lDiskFree = -1
Else
lDiskFree = DiskSpaceFree()
If Err <> 0 Then 'If Setup Toolkit's DLL couldn't be found
lDiskFree = -1
End If
End If
'
GetDiskSpaceFree = lDiskFree
'
'Cleanup by setting the current drive back to the original
'
ChDrive strCurDrive
Err = 0
End Function
Nos vemos.
Guillermo
Leyva-Salmeron, Pablo wrote:
> Hola amigos
>
> Mirando en las paginas del Guille he encontrado la funcion
> GetDiskFreeSpace para conocer el espacio libre en una unidad de disco.
>
> El problema es que lo necesito saber pero !!! con 16 bits !!!
>
> Alguien sabe como conseguirlo ?
>
> Muchas gracias desde ya mismo
> Un saludo