|
-
Jun 8th, 2000, 04:01 AM
#1
Thread Starter
Hyperactive Member
Hi, I am writing a watch program. The program should look over a folder and if somebody add/delete or rename any file, the program give them a message and log the error. I have been successful with the add/delete but I havn't had any luck detecting if anybody has rename the files. I am using a file control.
-
Jun 8th, 2000, 04:13 AM
#2
transcendental analytic
Loop regulary trough the items, and compare them to static copy of it in a method.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 8th, 2000, 05:32 AM
#3
Thread Starter
Hyperactive Member
Doesn't work!
Thanks for the help but how would I make an static copy of the item when they are dynamic and changable by the user?
-
Jun 8th, 2000, 05:55 AM
#4
transcendental analytic
Well you could redim it...
Static strcopy$()
Redim preserve strcopy(list.listcount)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 8th, 2000, 06:32 AM
#5
You can use the FindFirstChangeNotification() API to have you program wait for a Change to be made before going out to check and see what file it was, i.e.
Code:
Private Declare Function FindFirstChangeNotification Lib "kernel32" Alias "FindFirstChangeNotificationA" (ByVal lpPathName As String, ByVal bWatchSubtree As Long, ByVal dwNotifyFilter As Long) As Long
Private Declare Function FindNextChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
Private Declare Function FindCloseChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
Private Declare Function WaitForSingleObjectEx Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long, ByVal bAlertable As Long) As Long
Private Const FILE_NOTIFY_CHANGE_ATTRIBUTES = &H4
Private Const FILE_NOTIFY_CHANGE_DIR_NAME = &H2
Private Const FILE_NOTIFY_CHANGE_FILE_NAME = &H1
Private Const FILE_NOTIFY_CHANGE_LAST_WRITE = &H10
Private Const FILE_NOTIFY_CHANGE_SECURITY = &H100
Private Const FILE_NOTIFY_CHANGE_SIZE = &H8
Private lNotifyHandle As Long
Private bStop As Boolean
Private Sub Command1_Click()
Dim lReturn As Long
bStop = False
lNotifyHandle = FindFirstChangeNotification("C:\Test\", 1, FILE_NOTIFY_CHANGE_FILE_NAME)
If lNotifyHandle < 1 Then MsgBox "Couldn't get a Notify Handle": Exit Sub
While Not bStop
lReturn = WaitForSingleObjectEx(lNotifyHandle, 1, True)
If lReturn = 0 Then
Text1.SelText = "Something Changed" & vbCrLf
Call FindNextChangeNotification(lNotifyHandle)
End If
DoEvents
Wend
Call FindCloseChangeNotification(lNotifyHandle)
End Sub
Private Sub Command2_Click()
bStop = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
bStop = True
End Sub
Regards,
- Aaron.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|