📄 获取磁盘信息.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.DriveListBox Drive1
Height = 300
Left = 1587
TabIndex = 1
Top = 270
Width = 1545
End
Begin VB.CommandButton Command1
Caption = "信息"
Height = 375
Left = 1725
TabIndex = 0
Top = 2520
Width = 1230
End
Begin VB.Label Label3
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Height = 285
Left = 1587
TabIndex = 4
Top = 1710
Width = 1545
End
Begin VB.Label Label2
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Height = 285
Left = 1587
TabIndex = 3
Top = 1260
Width = 1545
End
Begin VB.Label Label1
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Height = 285
Left = 1587
TabIndex = 2
Top = 810
Width = 1545
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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
Private Type DriveInfo
SerialNum As Long
VolumeNam As String
FileSys As String
End Type
Dim Info As DriveInfo
Private Sub GetSerialNumber(strDrive As String)
Dim Res As Long
Info.VolumeNam = String(255, Chr(0))
Info.FileSys = String(255, Chr(0))
Res = GetVolumeInformation(strDrive, Info.VolumeNam, Len(Info.VolumeNam), Info.SerialNum, 0, 0, Info.FileSys, Len(Info.FileSys))
End Sub
Private Sub Command1_Click()
GetSerialNumber (Left(Drive1.Drive, 2) & "\")
Label1.Caption = Info.SerialNum
Label2.Caption = Info.VolumeNam
Label3.Caption = Info.FileSys
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -