Imports System.Runtime.InteropServices
Imports System.Text
Private Declare Ansi Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" ( _
ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As StringBuilder, _
ByVal nVolumeNameSize As Int32, _
[b]ByRef[/b] lpVolumeSerialNumber As Int32, _
[b]ByRef[/b] lpMaximumComponentLength As Int32, _
[b]ByRef[/b] lpFileSystemFlags As Int32, _
ByVal lpFileSystemNameBuffer As StringBuilder, _
ByVal nFileSystemNameSize As Int32) As Boolean
Dim r As Boolean
Dim iSerial As Int32
Dim sbVolumeName As New StringBuilder(256)
Dim sbFileSystemName As New StringBuilder(256)
r = GetVolumeInformation("D:\", sbVolumeName, sbVolumeName.Capacity, _
iSerial, 0, 0, sbFileSystemName, sbFileSystemName.Capacity)
MessageBox.Show(r.ToString() & " " & iSerial.ToString, Application.ProductName)