How to Get Floppy/CD/Hard Drive Serial Number
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 'File/Folder Handling - How to Get Floppy/CD/Hard Drive Serial Number Option Explicit Declare Function GetVolumeInformation Lib "kernel32.dll" Alias "GetVolumeInformationA" _ (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, _ lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, _ ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long Function GetSerialNumber(strDrive As String) As Long Dim SerialNum As Long, res As Long Dim Temp1 As String, Temp2 As String Temp1 = String$(255, Chr$(0)) Temp2 = String$(255, Chr$(0)) res = GetVolumeInformation(strDrive, Temp1, Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2)) GetSerialNumber = SerialNum End Function 'How can I call this function: Private Sub Command1_Click() Call MsgBox(GetSerialNumber("C:\")) End Sub |
Related posts:
- How to Return a volume’s serial number
- How to check whether CD/Floppy Disk is in the Drive
- How to get the USB’s Serial Number
- How to get Volume label, Serial Number and File system of a given drive name
- How to Return Volume Name for given Drive letter
- How to check whether the file system is FAT 32 or NTFS
- How to get free disk space of C drive (in two ways)
- How to Format Floppy Disk
- How to find Mother boad Serial Number
- How to find whether the given directory is empty (in three ways)