Thanks for the example RhinoBull, although it doesn't get me access to the drive name. Here is another example which gets me the drive label, although again it does not return the drive name:
So you see there is a difference between the drive name and the drive label, where the drive name is set by the manufacturer while the drive label is usually set by the user. I am trying to get access to the manufacturer's information regarding the drive including the model, etc.Code: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 Function Drivelabel(ByVal sDrive As String) As String Const clMaxLen As Long = 255 Dim SDriveLabel As String * clMaxLen, sFileSystem As String * clMaxLen, lSerial As Long sDrive = Left$(sDrive, 1) & ":\" Call GetVolumeInformation(sDrive, SDriveLabel, clMaxLen, lSerial, 0, 0, sFileSystem, clMaxLen) Drivelabel = "Drive label: " & Left$(SDriveLabel, InStr(1, SDriveLabel, vbNullChar) - 1) End Function




Reply With Quote