分辨率、卷标、序列号、分区表的读出

 

Option Explicit

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

Const FILE_VOLUME_IS_COMPRESSED = &H8000

Function GetSerialNumber(strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim Temp1 As String
Dim Temp2 As String
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInformation(strDrive, Temp1, Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
MsgBox Temp1
MsgBox Temp2
MsgBox Hex(SerialNum)
GetSerialNumber = SerialNum
End Function

Public Sub GetVolInfo(ByVal path As String)
Dim aa As Long
Dim VolName As String
Dim fsysName As String
Dim VolSeri As Long, compress As Long
Dim Sysflag As Long, Maxlen As Long
'初试化字符串的长度
VolName = String(255, 0)
fsysName = String(255, 0)
aa = GetVolumeInformation(path, VolName, 256, VolSeri, Maxlen, _
Sysflag, fsysName, 256)
VolName = Left(VolName, InStr(1, VolName, Chr(0)) - 1)
fsysName = Left(fsysName, InStr(1, fsysName, Chr(0)) - 1)
compress = Sysflag And FILE_VOLUME_IS_COMPRESSED
If compress = 0 Then
MsgBox "未压缩驱动器"
Else
MsgBox "压缩驱动器"
End If
MsgBox "驱动器卷标 :" + VolName
MsgBox "驱动器标号 : " + Hex(VolSeri)
MsgBox "驱动器文件系统 (FAT, HPFS, or NTFS)" + fsysName
MsgBox "支持的文件名长度" + Str$(Maxlen)
End Sub

Private Sub Command1_Click()
MsgBox GetSerialNumber("C:/")
End Sub


Private Sub Command2_Click()
Call GetVolInfo("C:/")
End Sub

Private Sub Command3_Click()
Dim cr As String
Dim Twidth As Integer
Dim Theight As Integer
cr = Chr$(13) + Chr$(10)
Twidth% = Screen.Width / Screen.TwipsPerPixelX
Theight% = Screen.Height / Screen.TwipsPerPixelY
MsgBox "屏幕大小为" + cr + cr + Str$(Twidth%) + " x" + Str$(Theight%), 64, "Info"
End Sub

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值