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

📄 form1.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form1 
   Caption         =   "批量改变多层文件夹中文件的属性"
   ClientHeight    =   3030
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5940
   LinkTopic       =   "Form1"
   ScaleHeight     =   3030
   ScaleWidth      =   5940
   StartUpPosition =   1  '所有者中心
   Begin VB.DirListBox Dir1 
      Height          =   930
      Left            =   75
      TabIndex        =   9
      Top             =   420
      Width           =   1815
   End
   Begin VB.FileListBox File1 
      Height          =   1530
      Left            =   75
      System          =   -1  'True
      TabIndex        =   8
      Top             =   1380
      Width           =   1815
   End
   Begin VB.DriveListBox Drive1 
      Height          =   300
      Left            =   75
      TabIndex        =   7
      Top             =   75
      Width           =   1815
   End
   Begin VB.CheckBox Check1 
      Caption         =   "只读"
      Height          =   210
      Left            =   3270
      TabIndex        =   6
      Top             =   555
      Width           =   840
   End
   Begin VB.CheckBox Check2 
      Caption         =   "隐藏"
      Height          =   210
      Left            =   4155
      TabIndex        =   5
      Top             =   570
      Width           =   840
   End
   Begin VB.CheckBox Check3 
      Caption         =   "系统"
      Height          =   210
      Left            =   5055
      TabIndex        =   4
      Top             =   555
      Width           =   840
   End
   Begin VB.TextBox Text1 
      Height          =   360
      Left            =   2850
      TabIndex        =   3
      Top             =   75
      Width           =   3060
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   330
      Left            =   4125
      TabIndex        =   1
      Top             =   2565
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   330
      Left            =   2490
      TabIndex        =   0
      Top             =   2565
      Width           =   1575
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "选中目录   "
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   270
      Left            =   1965
      TabIndex        =   2
      Top             =   150
      Width           =   5445
   End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Drive1_Change()    '选择驱动器
  Dir1.Path = Drive1.Drive
End Sub
Private Sub Dir1_Change()    '选择文件夹
  File1.Path = Dir1.Path
  Text1.Text = Dir1.Path
End Sub
Private Sub Command1_Click()   '改变文件属性
  Dim J As Integer
  Dim I As Integer
  Dim K As Integer
  Dim H As Integer
  If Dir1.ListCount > 0 Then   '如果选定目录包含文件夹
     For I = 0 To Dir1.ListCount - 1
         Dir1.ListIndex = I
         Dir1.Refresh
         File1.Path = Dir1.Path
         File1.Refresh
         FILEATTRIB
         If Dir1.ListCount > 0 Then
            For K = 0 To Dir1.ListCount - 1
                Dir1.ListIndex = I
                Dir1.Refresh
                File1.Path = Dir1.Path
                File1.Refresh
                FILEATTRIB       '修改文件属性
                If Dir1.ListCount > 0 Then
                   For H = 0 To Dir1.ListCount - 1
                       Dir1.ListIndex = I
                       Dir1.Refresh
                       File1.Path = Dir1.Path
                       File1.Refresh
                       FILEATTRIB
                       If Dir1.ListCount > 0 Then
                         Else
                          FILEATTRIB    '修改文件属性
                       End If
                   Next H
                  Else
                    FILEATTRIB       '修改文件属性
                End If
            Next K
          Else
            FILEATTRIB       '修改文件属性
         End If
     Next I
    Else
      FILEATTRIB      '修改文件属性
  End If
End Sub
Private Function FILEATTRIB()       '设置文件属性函数
  For J = 0 To File1.ListCount - 1
      File1.ListIndex = J
      If Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 0 Then _
         SetAttr File1.Path & "\" & File1.FileName, vbNormal
      If Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 1 Then _
         SetAttr File1.Path & "\" & File1.FileName, vbSystem
      If Check1.Value = 0 And Check2.Value = 1 And Check3.Value = 1 Then _
         SetAttr File1.Path & "\" & File1.FileName, vbHidden + vbSystem
      If Check1.Value = 1 And Check2.Value = 0 And Check3.Value = 1 Then _
         SetAttr File1.Path & "\" & File1.FileName, vbReadOnly + vbSystem
      If Check1.Value = 1 And Check2.Value = 1 And Check3.Value = 0 Then _
         SetAttr File1.Path & "\" & File1.FileName, vbReadOnly + vbSystem
      If Check1.Value = 1 And Check2.Value = 1 And Check3.Value = 1 Then _
         SetAttr File1.Path & "\" & File1.FileName, vbReadOnly + vbSystem + vbHidden
  Next J
End Function
Private Sub Command2_Click()
  End
End Sub

⌨️ 快捷键说明

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