📄 frmdisk.frm
字号:
TabIndex = 17
Top = 1440
Width = 855
End
Begin VB.Label lblPercentTotal
Alignment = 1 'Right Justify
Height = 255
Left = 3120
TabIndex = 16
Top = 1080
Width = 855
End
Begin VB.Label lblUsed
Height = 255
Left = 2040
TabIndex = 15
Top = 1800
Width = 855
End
Begin VB.Label Label6
Caption = "Used Space:"
Height = 255
Left = 120
TabIndex = 14
Top = 1800
Width = 1335
End
Begin VB.Label Label5
Caption = "Free Space:"
Height = 255
Left = 120
TabIndex = 13
Top = 1440
Width = 1335
End
Begin VB.Label Label4
Caption = "Total Space:"
Height = 255
Left = 120
TabIndex = 12
Top = 1080
Width = 1335
End
Begin VB.Label lblVolumeName
Height = 255
Left = 2040
TabIndex = 11
Top = 2160
Width = 2175
End
Begin VB.Label Label1
Caption = "Volume Name:"
Height = 255
Index = 6
Left = 120
TabIndex = 10
Top = 2160
Width = 1335
End
Begin VB.Label lblFileSystem
Height = 255
Left = 2040
TabIndex = 9
Top = 2880
Width = 2175
End
Begin VB.Label lblSerialNumber
Height = 255
Left = 2040
TabIndex = 8
Top = 2520
Width = 2175
End
Begin VB.Label Label1
Caption = "File System:"
Height = 255
Index = 5
Left = 120
TabIndex = 7
Top = 2880
Width = 1335
End
Begin VB.Label Label1
Caption = "Serial Number:"
Height = 255
Index = 2
Left = 120
TabIndex = 6
Top = 2520
Width = 1335
End
Begin VB.Label lblFree
Height = 255
Left = 2040
TabIndex = 5
Top = 1440
Width = 855
End
Begin VB.Label lblTotal
Height = 255
Left = 2040
TabIndex = 4
Top = 1080
Width = 855
End
Begin VB.Label Label9
Caption = "Lenght String:"
Height = 255
Left = 120
TabIndex = 3
Top = 3240
Width = 1335
End
Begin VB.Label lblLenghtString
Height = 255
Left = 2040
TabIndex = 2
Top = 3240
Width = 2175
End
End
Attribute VB_Name = "frmDisk"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Graph As New clsGraph
Private Sub cboDrives_Click()
picGraph.Refresh
cmdShowInfo_Click
End Sub
Private Sub cboPrimaryMaster_Click()
Dim Drv_Info As DRIVE_INFO
Dim sInfo As String
Dim sInfoAttr As String
Dim i As Integer
Drv_Info = GetDriveInfo(cboPrimaryMaster.ListIndex)
sInfo = cboPrimaryMaster.List(cboPrimaryMaster.ListIndex)
sInfo = sInfo & ": " & vbCrLf
txtAdvancedInfo.Text = ""
With Drv_Info
lblFirmware.Caption = .FirmWare
lblModelo.Caption = .Model
lblSerialN.Caption = .SerialNumber
lblCilinders.Caption = .Cilinders
lblHeads.Caption = .Heads
lblSecPerTrack.Caption = .SecPerTrack
If .bDriveType = 0 Then sInfo = sInfo & "[Not present]"
lblType.Caption = "[Not present]"
If .bDriveType = 2 Then sInfo = sInfo & "[ATAPI drive - info not available]"
lblType.Caption = "[ATAPI drive - info not available]"
If .bDriveType = 1 Then
lblType.Caption = "[IDE drive]"
sInfoAttr = Format("Attribute Name", String(24, "@") & "!") & Format("Value", String(7, "@") & "!") & Format("Threshold", String(11, "@") & "!") & Format("WorstValue", String(12, "@") & "!") & "Status" & vbCrLf
sInfoAttr = sInfoAttr & String(60, "-") & vbCrLf
For i = 1 To .NumAttributes - 1
sInfoAttr = sInfoAttr & Format(.Attributes(i).AttrName, String(25, "@") & "!") & Format(.Attributes(i).AttrValue, String(3, "@")) & vbTab & Space(2) & Format(.Attributes(i).ThresholdValue, String(3, "@")) & vbTab & Format(.Attributes(i).WorstValue, String(8, "@")) & vbTab & Format("&H" & Hex(.Attributes(i).StatusFlags), String(4, "@"))
sInfoAttr = sInfoAttr & vbNewLine
Next i
txtAdvancedInfo.Text = sInfoAttr
End If
End With
End Sub
Private Sub cmdShowInfo_Click()
Dim Bytes_Avail As LARGE_INTEGER
Dim Bytes_Total As LARGE_INTEGER
Dim Bytes_Free As LARGE_INTEGER
lReturn = GetDiskFreeSpace(sDrive, lSectorsPerCluster, lBytesPerSector, lFreeClusters, lTotalClusters)
lblSectorPerClusters.Caption = lSectorsPerCluster
lblBytesPerClusters.Caption = lBytesPerSector
lblFreeCluster.Caption = lFreeClusters
lblTotalClusters.Caption = lTotalClusters
On Error Resume Next
GetDiskFreeSpaceEx cboDrives.Text, Bytes_Avail, Bytes_Total, Bytes_Free
Dbl_Total = LargeIntegerToDouble(Bytes_Total.Lowpart, Bytes_Total.Highpart)
Dbl_Free = LargeIntegerToDouble(Bytes_Free.Lowpart, Bytes_Free.Highpart)
lblTotal.Caption = SizeString(Dbl_Total)
lblFree.Caption = SizeString(Dbl_Free)
lblUsed.Caption = SizeString(Dbl_Total - Dbl_Free)
lblPercentTotal.Caption = Format$(1, "percent")
lblPercentFree.Caption = Format$(Dbl_Free / Dbl_Total, "percent")
lblPercentUsed.Caption = Format$((Dbl_Total - Dbl_Free) / Dbl_Total, "percent")
txtFree.Text = Format$(Dbl_Free / Dbl_Total) * 100
txtUsed.Text = Format$((Dbl_Total - Dbl_Free) / Dbl_Total) * 100
Root = cboDrives.Text
Volume_Name = Space$(1024)
File_System_Name = Space$(1024)
'*********
If GetVolumeInformation(Root, Volume_Name, Len(Volume_Name), Serial_Number, Max_Component_Length, File_System_Flags, File_System_Name, Len(File_System_Name)) = 0 Then
picGraph.Cls
lblPercentTotal.Caption = ""
lblPercentFree.Caption = ""
lblPercentUsed.Caption = ""
lblVolumeName.Caption = ""
lblSerialNumber.Caption = ""
lblFileSystem.Caption = ""
lblLenghtString.Caption = ""
lblSectorPerClusters.Caption = ""
lblBytesPerClusters.Caption = ""
lblFreeCluster.Caption = ""
lblTotalClusters.Caption = ""
MsgBox "No Disk!", vbExclamation, "Error when Reading the Disk"
Exit Sub
End If
'**********
Pos = InStr(Volume_Name, Chr$(0))
Volume_Name = Left$(Volume_Name, Pos - 1)
lblVolumeName.Caption = Volume_Name
lblSerialNumber.Caption = Format$(Serial_Number)
Pos = InStr(File_System_Name, Chr$(0))
File_System_Name = Left$(File_System_Name, Pos - 1)
lblFileSystem.Caption = File_System_Name
lblLenghtString.Caption = Format$(Max_Component_Length)
'********************************
Graph.AddSegment txtFree.Text, "Free Space", &HFF00FF 'Magenta'
Graph.AddSegment txtUsed.Text, "Used Space", &HFF0000 'Blue'
Graph.DrawPie picGraph.hdc, picGraph.hwnd, True, "HDD Information"
Graph.Clear
'******************************
End Sub
Private Sub Form_Load()
lBuffer = 26 * 4 + 1
sDriveNames = Space$(lBuffer)
lReturn = GetLogicalDriveStrings(lBuffer, sDriveNames)
nOffset = 1
Do
sTempStr = Mid$(sDriveNames, nOffset, 3)
If Left$(sTempStr, 1) = vbNullChar Then Exit Do
cboDrives.AddItem UCase(sTempStr)
nOffset = nOffset + 4
Loop
cboDrives.ListIndex = 1
With cboPrimaryMaster
.AddItem "PRIMARY_MASTER"
.AddItem "PRIMARY_SLAVE"
.AddItem "SECONDARY_MASTER"
.AddItem "SECONDARY_SLAVE"
End With
cboPrimaryMaster.ListIndex = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set Graph = Nothing
End Sub
Private Sub cmdAboutMe_Click()
MsgBox "HDD Information v1.0 25-06-2004" & vbNewLine & vbNewLine & "Info:" & vbNewLine & "HDD Information Show Firmware, Space Free, Model, Name" & vbNewLine & "Space Used, Graph, System Files, Etc of a Hard Disk" & vbNewLine & vbNewLine & "Vote for Me" & vbNewLine & vbNewLine & "Planet Source Code: www.planet-source-code.com/vb" & vbNewLine & vbNewLine & "Thank to vbAcceletaror.com , Planet Source Code, Trevor Newsome for Extract de Code Used in HDD." & vbNewLine & vbNewLine & "Daniel Carrasco Olguin (Daniel PC)" & vbNewLine & vbNewLine & "Santiago de Chile" & vbNewLine & vbNewLine & "Vote for Me", vbInformation + vbOKOnly
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -