看看有无帮助:<br>取得磁盘序列号、卷标和文件系统类型 <br>磁盘序列号在每次软盘或硬盘格式化后都重新生成,并且不回重复。许多程序员用此加密。其实也可以修改该函数,可以得到磁盘卷标和文件系统类型信息。<br><br>声明:<br>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<br><br>代码:<br><br>Function GetSerialNumber(sRoot As String) As Long<br> Dim lSerialNum As Long<br> Dim R As Long<br> Dim sTemp1 As String, sTemp2 As String<br> strLabel = String$(255, Chr$(0))<br> ' 磁盘卷标<br> strType = String$(255, Chr$(0))<br> ' 文件系统类型 一般为 FAT <br> R = GetVolumeInformation(sRoot, strLabel, Len(strLabel), lSerialNum, 0, 0, strType, Len(strType))<br> GetSerialNumber = lSerialNum<br> '在 strLabel 中为 磁盘卷标<br> '在 strType 中为 文件系统类型<br>End Function<br><br>用法:<br><br>当驱动器不存在时,函数返回 0。如果是个非根目录,也将返回 0:<br><br>lSerial = GetSerialNumber("c:/")<br><br><br>