Public Function GetSysDiskID () As String Dim sDriveLetter As String Dim RetVal As Long Dim lpName As String Dim nSize As Long Dim nSerial As Long Dim lpMaxComp As Long Dim nFileFlags As Long Dim lpFileName As String Dim sPath As String sPath = Space (255) lpName = Space (255) lpFileName = Space (255) nSize = 255 GetWindowsDirectory sPath, 255 sDriveLetter = Left (sPath, 3) RetVal = GetVolumeInformation (sDriveLetter, lpName, _ nSize, nSerial, lpMaxComp, nFileFlags, lpFileName, nSize)
If RETVAL = 0 THEN EXIT function else getsysdiskid = cstr (nserial) endiff
END FUNCTION
statement
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
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "getWindowsDirectorya" (Byval nsize as long) As long