技能学习网 首页 电脑互联网 网络编程 Access 查看内容

取得磁碟机之Volumn及Serial Number

bwin下载手机app www.stoneresources.cn 2015-2-27 20:20| 发布者: jcy6| 查看: 1886| 评论: 0|原作者: jcy6

摘要: 适用ACCESS97、2000 这两项磁碟机资料须使用API函数方可取得,代码如下: 以下为引用的内容: Private Declare
电源插座极性检测器

适用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),可取得磁碟机的两项资料。



?

关于我们|问题解答|积分充值|积分规则|版主申请|广告申请|友链申请|手机版|小黑屋|bwin下载手机app ( 原教程自学网 )

GMT+8, 2018-9-9 04:52 , Processed in 0.364663 second(s), 20 queries .

Powered by 技能学习网版权所有/联系QQ:3116139800 电话:0755-32875005 邮箱:mail@jcy6.com bwin下载手机app X3.2 © 2001-2013 bwin下载手机app

返回顶部
新闻 网页 音乐 贴吧 图片

互联网www.sogou.com