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

📄 form1.frm

📁 一个递归算法,并把递归出的文件隐藏,使用VB开发,希望大家支持
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   8055
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10035
   LinkTopic       =   "Form1"
   ScaleHeight     =   8055
   ScaleWidth      =   10035
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   420
      Left            =   360
      TabIndex        =   2
      Top             =   6390
      Width           =   1005
   End
   Begin VB.ListBox List1 
      Height          =   7800
      Left            =   1800
      TabIndex        =   1
      Top             =   90
      Width           =   8205
   End
   Begin MSComctlLib.TreeView TV 
      Height          =   5550
      Left            =   180
      TabIndex        =   0
      Top             =   360
      Width           =   1545
      _ExtentX        =   2725
      _ExtentY        =   9790
      _Version        =   393217
      Style           =   7
      Appearance      =   1
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim fso As New FileSystemObject
    Dim subfolder
    Dim f2
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f2 = fso.GetFile("c:\a.txt")
    f2.Attributes = 1
End Sub

Private Sub Form_Load()
'    LoadTv


End Sub

Private Sub LoadTv()
    TV.Nodes.Clear
    Dim Dri As Drive
    Dim fso As New FileSystemObject
    Set fso = CreateObject("Scripting.FileSystemObject")
    For Each Dri In fso.Drives
    On Error GoTo err1
        If Dri.IsReady = True Then
            LoadFq Dri.Path
            List1.AddItem Dri.Path
        End If
err1:
    Next
End Sub

Private Sub LoadFq(strPath As String)
    Dim fso As New FileSystemObject
    Dim subfolder
    Set fso = CreateObject("Scripting.FileSystemObject")
    For Each subfolder In fso.GetFolder(strPath).SubFolders
        If subfolder.SubFolders.Count > 0 Then
            LoadFq subfolder.Path
        End If
        List1.AddItem subfolder.Path
        If subfolder.Files.Count > 0 Then
            For Each thefile In subfolder.Files
                Set f2 = fso.GetFile(thefile.Path)
                f2.Attributes = 1
                List1.AddItem thefile.Path
            Next
        End If
    Next
End Sub

⌨️ 快捷键说明

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