手揣网教程:绿色安全纯净官方版,体验当今速度最快的浏览器!

取得磁碟机之Volumn及Serial Number

时间:2024/9/13作者:未知来源:手揣网教程人气:

[摘要]适用ACCESS97、2000 这两项磁碟机资料须使用API函数方可取得,代码如下:Private Declare Function GetVolumeInformation Lib "k...
适用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),可取得磁碟机的两项资料。

全新的路由器不仅让你更稳定快速地连接无线网络,更可以让家中的智能设备连接在一起。



关键词:取得磁碟机之Volumn及Serial Number




Copyright © 2012-2018 手揣网教程(http://www.shouchuai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版