欢迎光临
我们一直在努力

取得磁碟机之Volumn及Serial Number

建站超值云服务器,限时71元/月

适用ACCESS97、2000

这两项磁碟机资料须使用API函数方可取得,代码如下:

中国站长_站,为中文网站提供动力

以下为引用的内容:

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) As Long 中.国站长站

Function GetVolumn(X As String) As String
    If Len(X) < 3 Then
        X = Left(X, 1) & ":\"
    Else
        X = Left(X, 3)
    End If
    Dim nRet As Long, VolName As String, VolSN As Long, MaxCompLen As Long
    Dim VolFlags As Long, VolFileSys As String
    VolName = Space$(256)
    VolFileSys = Space$(256)
    nRet = GetVolumeInformation(X, VolName, Len(VolName), _
            VolSN, MaxCompLen, VolFlags, _
            VolFileSys, Len(VolFileSys))
    If nRet = 1 Then
        GetVolumn = VolName
    Else
        GetVolumn = "" [中国站长站]
    End If
End Function [中国站长站]

Function GetNumber(X As String) As String
    If Len(X) < 3 Then
        X = Left(X, 1) & ":\"
    Else
        X = Left(X, 3)
    End If
    Dim nRet As Long, VolName As String, VolSN As Long, MaxCompLen As Long
    Dim VolFlags As Long, VolFileSys As String
    VolName = Space$(256)
    VolFileSys = Space$(256)
    nRet = GetVolumeInformation(X, VolName, Len(VolName), _
            VolSN, MaxCompLen, VolFlags, _
            VolFileSys, Len(VolFileSys))
    If nRet = 1 Then
        GetNumber = VolSN
    Else
        GetVolumn = ""

站长.站

    End If
End Function
中国.站.长站

中国站长.站

前面的Declare陈述式宣告一个API函数(GetVolumeInformation),可取得磁碟机的两项资料。

Www^Chinaz^com

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 取得磁碟机之Volumn及Serial Number
分享到: 更多 (0)