Salut a tous,
voila j'essaie de faire un programme permettant de savoir si des fichiers ont ete modifiés dans un dossier. Ca marche seulement mes boutons sont bloqués aprés. Voici mon code:
Private Sub Command1_Click()
Dim Ret As Long
'Set the notification hook
Ret = FindFirstChangeNotification("C:\temp2", &HFFFFFFFF, FILE_NOTIFY_CHANGE_ALL)
flag = False
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the first time"
'Reactivate our hook
Do While flag = False
FindNextChangeNotification Ret
'Wait until the event is triggered
DoEvents
WaitForSingleObject Ret, &HFFFFFFFF
DoEvents
MsgBox "Event Triggered for the second time"
'Remove our hook
Loop
FindCloseChangeNotification Ret
End Sub
Private Sub Command2_Click()
flag = True
End Sub
En faite j'aimerais que lorsque je click sur le bouton 2 il arrete de surveiller le dossier mais impossible de clicker sur le 2eme bouton. Je pensait que l'instruction Doevent suffirait mais non.
Merci de votre aide.