Friday, November 28, 2008

VB > Get a drives drive and volume info


Declare Function GetVolumeInformation 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

Declare Function GetDriveType Lib "kernel32" _
Alias "GetDriveTypeA" (ByVal nDrive As String) As Long


Private Sub cmdGetVol_Click()

Dim VolName As String, FSys As String, erg As Long
Dim VolNumber As Long, MCM As Long, FSF As Long
Dim Drive As String, DriveType As Long

VolName = Space(127)
FSys = Space(127)

Drive = "C:\" 'Enter the driverletter you want
DriveType& = GetDriveType(Drive$)

erg& = GetVolumeInformation(Drive$, VolName$, 127&, _
VolNumber&, MCM&, FSF&, FSys$, 127&)

Print "VolumeName:" & vbTab & VolName$
Print "VolumeNumber:" & vbTab & VolNumber&
Print "MCM:" & vbTab & vbTab & MCM&
Print "FSF:" & vbTab & vbTab & FSF&
Print "FileSystem:" & vbTab & FSys$
Print "DriveType:" & vbTab & DriveType&;

End Sub

Seja o primeiro a comentar

Post a Comment

Latest Comments

About Me

My photo
Makassar, Sulawesi Selatan, Indonesia

Guest Book


ShoutMix chat widget

Script Sense ©Template Blogger Green by Dicas Blogger.

TOPO