Problem med GetVolumeInformation i Visual Basic 6

M

Mr. Kiran V. Sutar

Guest
Hej Forum Medlemmer,
Jeg har skrevet følgende lille rutine i VisualBasic6:

Citat:Dim strVolumeNameBuffer As String * 11 'Kan kun 11 bytes

Dim strFileSystemNameBuffer, strClient As StringPrivate 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 SubPrivate Sub btnGetVolumeInfo_Click ()

Dim itemp1 As Integer

Dim str1 As StringstrDrive = Me.txtVolume.Text

strVolumeNameBuffer = Space (11)

strFileSystemNameBuffer = Space (255)

GetVolumeInformation Venstre (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) & vbCrLfstr1 = str1 & "VolumeMaximumComponentLength:" & Str (lngMaximumComponentLength) & vbCrLf

str1 = str1 & "VolumeFileSystemFlags:" & Str (lngFileSystemFlags) & vbCrLf

str1 = str1 & "VolumeFileSystemNameBuffer:" & strFileSystemNameBuffer & vbCrLf

str1 = str1 & "VolumeFileSystemNameBufferSize:" & Str (Len (strFileSystemNameBuffer)) & vbCrLf

MsgBox str1itemp1 = FreeFile ()

Åbn Trim (App.Path & "\ VolumeInfo.Txt") For Append Adgang skrive så itemp1

Print # itemp1, str1

Close # itemp1End Sub
 

Welcome to EDABoard.com

Sponsor

Back
Top