Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• Adjust flexgrid cell
• Animation
• Centering form text
• Coffee machine
• Creating fileshares
• Creating shortcuts
• Custom buttons
• Directory browser
• Disable mouse events
• File search by ext
• File transfer
• File watcher
• Formatting flexgrid
• Get Content Type
• Get HTML source
• Get modem port
• HTTP proxy
• ipconfig
• Large file split/merge
• MAPI
• MCI Sound Player
• Menu with images
• MP3 normalizer
• Net Send
• Netstat 2000
• No duplicate entries
• Outlook Address Book
• Set font color
• Shapes
• SOAP test
• Text-to-image
• Text file viewer
• Text find/replace
• UPS component
• View NT groups
• Word template
• Writing DNS control
    • Using DNS control
• Writing SMTP control
    • Sending email
    • Mailing list
• Writing WhoIs control
    • Using WhoIs control
• View HTML source
VB projects - File Watcher

Description: Program that monitors changes in selected directory (adding/deleting files)
Minimum requirements: vb
Download: source code
Screenshot:
file watcher (3017 bytes)
Project: Standard EXE
Controls: Drive1 (DriveListBox), Dir1 (DirListBox), File1 (FileListBox), tmr (Timer), cmdStart (Command button)
Code:
Dim nCount As Long

Private Sub cmdStart_Click()
    If cmdStart.Caption = "Start" Then
        cmdStart.Caption = "Stop"
        nCount = File1.ListCount
        tmr.Enabled = True
    Else
        tmr.Enabled = False
        cmdStart.Caption = "Start"
    End If
End Sub

Private Sub Dir1_Change()
    File1.Path = Dir1.List(Dir1.ListIndex)
End Sub

Private Sub Drive1_Change()
    If InStr(Drive1.Drive, ":") <> 0 Then
        Dir1.Path = Left(Drive1.Drive, InStr(Drive1.Drive, ":"))
    Else
        Dir1.Path = Drive1.Drive & "/"
    End If
End Sub

Private Sub tmr_Timer()
    File1.Refresh
    If File1.ListCount > nCount Then
        MsgBox "File has been added"
        nCount = File1.ListCount
    ElseIf File1.ListCount < nCount Then
        MsgBox "File has been deleted"
        nCount = File1.ListCount
    End If
End Sub

Copyright © 1996-2008 OstroSoft. All rights reserved. info@ostrosoft.com