PDA

Click to See Complete Forum and Search --> : API to get Floppy Disk Label/SN


JoshT
Dec 7th, 2000, 10:28 AM
Is there an API call to get the label and/or serial number of a floppy disk?

I want to write a program that will allow one click copying of floppies to a CD-RW. So while the program is running, I click the button, it copies my floppy to a folder named by the floppy label (or serial number if it doesn't have a label), when thats done I can pop out the floppy & copy another one. So I can sit there and backup lots of floppies easily.

Thanks,
Josh

Dec 7th, 2000, 02:20 PM
To get the serial number, use the GetVolumeInformation api function.

Private 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
Dim Res As Long
Dim Temp1 As String
Dim 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

Usage

MsgBox GetSerialNumber("A:\")

JoshT
Dec 8th, 2000, 09:20 AM
It's the same one used for hard drives, right?

I overlooked the obvious...
Josh