Palabras clave:
API, averiguar, extraer, saber, numero serie, volumen, discoAutor:
Búho desarrollando una idea de Eduardo MorcilloExtraído de:
La web del Búho
Objetivo Extraer el número de serie del volumen (dado al formatear) mediante API.
Private Declare Function GetVolumeSerialNumber Lib "kernel32" Alias _
"GetVolumeInformationA" (ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long
Sub VolumeSerialNumber()
Dim VolLabel As String
Dim VolSize As Long
Dim Serial As Long
Dim MaxLen As Long
Dim Flags As Long
Dim Name As String
Dim NameSize As Long
Dim S As String
Dim Ret As Boolean
Ret = GetVolumeSerialNumber("C:\", VolLabel, VolSize, Serial, MaxLen, _
Flags, Name, NameSize)
If Ret Then
S = Format(Hex(Serial), "00000000")
MsgBox "Serie del Volumen: " & Left(S, 4) + "-" + Right(S, 4)
Else
MsgBox "0000-0000"
End If
End Sub
Te puede interesar...
Número de serie del volumen (mediante FSO)Número de serie del volumen (mediante WMI)