Hi,
this thread is just what I was looking for -- much thanks to all !
Having said that, I am going to show my ignorance.
I program in Visual Studio .NET VB for a while now & have not come accross
a part of your example :
strVolName As String * cMaxPath
VB gives me an error on the "* cMaxPath" expects end ot statment.
Not sure what this syntax means - Thanks Again
----- Frank Kabel wrote: -----
Hi
you may use the HD drive ID for this. The following code gets this
number:
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 get_drive_serial()
Const cMaxPath = 256, cDrive = "C:\"
Dim lngtemp
Dim strTemp As String, lngRet As Long
Dim lngVolSerial As Long, strVolName As String * cMaxPath
Dim lngMaxCompLen As Long, lngFileSysFlags As Long
Dim strFileSysName As String * cMaxPath
lngRet = GetVolumeInformation(cDrive, strVolName, cMaxPath, _
lngTemp, lngMaxCompLen, lngFileSysFlags, strFileSysName, _
cMaxPath)
strTemp = Format(Hex(lngTemp), "00000000")
strTemp = Left(strTemp, 4) & "-" & Right(strTemp, 4)
get_drive_serial = strTemp
End Sub