Dim strVolumeNameBuffer As String * 11 'Can only be 11 bytes
Dim strFileSystemNameBuffer, strClient As String
Private 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
Private Sub btnExit_Click()
Unload Me
End Sub
Private Sub btnGetVolumeInfo_Click()
Dim itemp1 As Integer
Dim str1 As String
strDrive = Me.txtVolume.Text
strVolumeNameBuffer = Space(11)
strFileSystemNameBuffer = Space(255)
GetVolumeInformation Left(strDrive, 2) & "\", strVolumeNameBuffer, Len(strVolumeNameBuffer), lngVolumeSerialNumber, lngMaximumComponentLength, lngFileSystemFlags, strFileSystemNameBuffer, Len(strFileSystemNameBuffer)
str1 = "Drive : " & strDrive & vbCrLf
str1 = str1 & "VolumeNameBuffer : " & strVolumeNameBuffer & vbCrLf
str1 = str1 & "VolumeSerialNumber : " & Str(lngVolumeSerialNumber) & vbCrLf
str1 = str1 & "VolumeMaximumComponentLength : " & Str(lngMaximumComponentLength) & vbCrLf
str1 = str1 & "VolumeFileSystemFlags : " & Str(lngFileSystemFlags) & vbCrLf
str1 = str1 & "VolumeFileSystemNameBuffer : " & strFileSystemNameBuffer & vbCrLf
str1 = str1 & "VolumeFileSystemNameBufferSize : " & Str(Len(strFileSystemNameBuffer)) & vbCrLf
MsgBox str1
itemp1 = FreeFile()
Open Trim(App.Path & "\VolumeInfo.Txt") For Append Access Write As itemp1
Print #itemp1, str1
Close #itemp1
End Sub