⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmformatdrive.frm

📁 格式化硬盘,在VB开发环境下实现硬盘格式化程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frm_format_disk 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "格式化硬盘"
   ClientHeight    =   4050
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   2400
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4050
   ScaleWidth      =   2400
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Height          =   3735
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   1935
      Begin VB.CommandButton Command7 
         Caption         =   "格式化H:盘"
         Height          =   375
         Left            =   240
         TabIndex        =   7
         Top             =   3120
         Width           =   1455
      End
      Begin VB.CommandButton Command6 
         Caption         =   "格式化G:盘"
         Height          =   375
         Left            =   240
         TabIndex        =   6
         Top             =   2640
         Width           =   1455
      End
      Begin VB.CommandButton Command5 
         Caption         =   "格式化F:盘"
         Height          =   375
         Left            =   240
         TabIndex        =   5
         Top             =   2160
         Width           =   1455
      End
      Begin VB.CommandButton Command4 
         Caption         =   "格式化E:盘"
         Height          =   375
         Left            =   240
         TabIndex        =   4
         Top             =   1680
         Width           =   1455
      End
      Begin VB.CommandButton Command3 
         Caption         =   "格式化D:盘"
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   1200
         Width           =   1455
      End
      Begin VB.CommandButton Command2 
         Caption         =   "格式化C:盘"
         Height          =   375
         Left            =   240
         TabIndex        =   2
         Top             =   720
         Width           =   1455
      End
      Begin VB.CommandButton Command1 
         Caption         =   "格式化软盘"
         Height          =   375
         Left            =   240
         TabIndex        =   1
         Top             =   240
         Width           =   1455
      End
   End
End
Attribute VB_Name = "frm_format_disk"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const SHFD_CAPACITY_DEFAULT = 0 ' default drive capacity
Const SHFD_CAPACITY_360 = 3 ' 360KB, applies to 5.25" drives only
Const SHFD_CAPACITY_720 = 5 ' 720KB, applies to 3.5" drives only
Const SHFD_FORMAT_QUICK = 0 ' quick format
Const SHFD_FORMAT_FULL = 1 ' full format
Const SHFD_FORMAT_SYSONLY = 2 ' copies system files only (Win95 Only!)

Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwndOwner As Long, ByVal iDrive As Long, ByVal iCapacity As Long, ByVal iFormatType As Long) As Long

Private Sub Command1_Click()

   'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
    SHFormatDrive Me.hWnd, 0, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
    
End Sub

Private Sub Command2_Click()
    On Error GoTo end_sub
    'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
    SHFormatDrive Me.hWnd, 2, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
    Exit Sub
end_sub:
   MsgBox Err.Description
End Sub

Private Sub Command3_Click()
    On Error GoTo end_sub
    'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
    SHFormatDrive Me.hWnd, 3, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
    Exit Sub
end_sub:
    MsgBox Err.Description
End Sub

Private Sub Command4_Click()
    On Error GoTo end_sub
    'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
    SHFormatDrive Me.hWnd, 4, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
    Exit Sub
end_sub:
    MsgBox Err.Description
End Sub

Private Sub Command5_Click()
    On Error GoTo end_sub
    'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
    SHFormatDrive Me.hWnd, 5, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
    Exit Sub
end_sub:
    MsgBox Err.Description
End Sub

Private Sub Command6_Click()
    On Error GoTo end_sub
    'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
    SHFormatDrive Me.hWnd, 6, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
    Exit Sub
end_sub:
    MsgBox Err.Description
End Sub

Private Sub Command7_Click()
    On Error GoTo end_sub
    'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
    SHFormatDrive Me.hWnd, 7, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
    Exit Sub
end_sub:
    MsgBox Err.Description
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -