如何检测磁盘序列号?(5分)

  • 主题发起人 主题发起人 studycyz222
  • 开始时间 开始时间
S

studycyz222

Unregistered / Unconfirmed
GUEST, unregistred user!
如何检测磁盘序列号?(不是卷序列号)<br>请告之API
 
看看有无帮助:<br>取得磁盘序列号、卷标和文件系统类型 <br>磁盘序列号在每次软盘或硬盘格式化后都重新生成,并且不回重复。许多程序员用此加密。其实也可以修改该函数,可以得到磁盘卷标和文件系统类型信息。<br><br>声明:<br>Private Declare Function GetVolumeInformation Lib "kernel32.dll" Alias "GetVolumeInformationA" &nbsp; &nbsp; (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize &nbsp;As Integer, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags &nbsp;As Long, ByVal lpFileSystemNameBuffer As String, &nbsp;ByVal nFileSystemNameSize As Long) As Long<br><br>代码:<br><br>Function GetSerialNumber(sRoot As String) As Long<br>&nbsp; &nbsp; Dim lSerialNum As Long<br>&nbsp; &nbsp; Dim R As Long<br>&nbsp; &nbsp; Dim sTemp1 As String, sTemp2 As String<br>&nbsp; &nbsp; strLabel = String$(255, Chr$(0))<br>&nbsp; ' &nbsp;磁盘卷标<br>&nbsp; &nbsp; strType = String$(255, Chr$(0))<br>&nbsp; ' 文件系统类型 一般为 FAT <br>&nbsp; &nbsp; R = GetVolumeInformation(sRoot, strLabel, Len(strLabel), lSerialNum, 0, 0, strType, Len(strType))<br>&nbsp; &nbsp; GetSerialNumber = lSerialNum<br>&nbsp; '在 strLabel 中为 磁盘卷标<br>&nbsp; '在 strType &nbsp;中为 文件系统类型<br>End Function<br><br>用法:<br><br>当驱动器不存在时,函数返回 0。如果是个非根目录,也将返回 0:<br><br>lSerial = GetSerialNumber("c:/")<br><br><br>
 
这个好像是VB的,请注意,看对方需要的是什么软件的
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=577769
 
后退
顶部