Problema com GetVolumeInformation em Visual Basic 6

  • Thread starter Sr. V. Sutar Kiran
  • Start date
S

Sr. V. Sutar Kiran

Guest
Oi Fórum deputados,
Escrevi uma pequena rotina em VisualBasic6 seguintes:

Citação:Dim strVolumeNameBuffer As String * 11 'só pode ter 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 Esquerda (strDrive, 2) & "\", strVolumeNameBuffer, Len (strVolumeNameBuffer), lngVolumeSerialNumber, lngMaximumComponentLength, lngFileSystemFlags, strFileSystemNameBuffer, Len (strFileSystemNameBuffer)str1 = "Drive:" & vbCrLf & strDrive

str1 = str1 & "VolumeNameBuffer:" & vbCrLf & strVolumeNameBuffer

str1 = str1 & "VolumeSerialNumber:" & Str (lngVolumeSerialNumber) & vbCrLfstr1 = str1 & "VolumeMaximumComponentLength:" & Str (lngMaximumComponentLength) & vbCrLf

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

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

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

MsgBox str1itemp1 = FreeFile ()

Abrir Trim (App.Path & "\ VolumeInfo.Txt") para escrever, como Access Append itemp1

Imprimir # itemp1, str1

Fechar # itemp1End Sub
 

Welcome to EDABoard.com

Sponsor

Back
Top