获得硬盘D盘序列号

2021年9月30日 24点热度 0条评论 来源: iwebsms

'获得硬盘C盘序列号

Function GetDrvID() As Long

    Dim GetVal As Long

    Dim TempStr1 As New String(Chr(0), 255)

    Dim TempStr2 As New String(Chr(0), 255)

 

    Dim TempLon1 As Integer

 

    Dim TempLon2 As Integer

 

    Dim lres As Integer

 

    lres = GetVolumeInformation("D:", TempStr1, 256, GetVal, TempLon1, TempLon2, TempStr2, 256)

    Return GetVal

End Function

 

    Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, ByRef lpVolumeSerialNumber As Long, ByVal lpMaximumComponentLength As Integer, ByVal lpFileSystemFlags As Integer, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Integer) As Integer

    原文作者:iwebsms
    原文地址: https://blog.csdn.net/iwebsms/article/details/119848
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。