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

📄 form1.frm

📁 delphi 做的监控文件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "初级:监控打开的文件夹"
   ClientHeight    =   5880
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8610
   LinkTopic       =   "Form1"
   ScaleHeight     =   5880
   ScaleWidth      =   8610
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer1 
      Left            =   6960
      Top             =   2280
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查找"
      Height          =   495
      Left            =   7200
      TabIndex        =   1
      Top             =   840
      Width           =   1215
   End
   Begin VB.ListBox List1 
      Height          =   5460
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6735
   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 AFW As Collection
    
    Call GetAllFileWindows(AFW)
    
    List1.Clear
    For Each obj In AFW
        List1.AddItem obj
    Next
End Sub

Private Sub Timer1_Timer()
    Timer1.Enabled = False
    Call CheckAllFileDialog
    Timer1.Enabled = True
End Sub

Sub GetAllFileWindows(ByRef AFW As Collection)
    Dim iewindow As Object
    Dim currentwindows As New ShellWindows
    Dim currentlocation As String
    
    On Error Resume Next
    If AFW Is Nothing Then
        Set AFW = New Collection
    End If
    
    For Each iewindow In currentwindows
        DoEvents
        
        If iewindow.Busy Then
            GoTo busysignal
        End If
        
        If Right(iewindow.FullName, 12) <> "iexplore.exe" Then
            currentlocation = iewindow.LocationURL
            If Mid$(currentlocation, 1, 7) = "file://" Then
                currentlocation = Replace(currentlocation, "file:///", "")
                currentlocation = Replace(currentlocation, "%20", " ")
                currentlocation = Replace(currentlocation, "/", "\")
                
                AFW.Add currentlocation
            Else
                AFW.Add iewindow.LocationName
            End If
        End If
busysignal:
    Next
    On Error GoTo 0
End Sub

⌨️ 快捷键说明

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