HELP HELP - Surveillance d'un répertoire.

cs_kuss Messages postés 30 Date d'inscription mardi 5 août 2003 Statut Membre Dernière intervention 2 août 2007 - 6 août 2003 à 17:28
osmose06 Messages postés 28 Date d'inscription samedi 29 décembre 2001 Statut Membre Dernière intervention 28 janvier 2006 - 23 mai 2004 à 10:16
Je suis à la recherche d'un petit soft en VB qui me permette de surveiller un répertoire (dans lequel arrive régulièrement des photos (il faut donc attendre que la photo soit complètement copiée sur le disque), afficher la photo a l'écran et en faire une copie dans un répertoire de backup.

Je suis entrain de pleurer tellement je tourne en rond et mon patron s'énerve derrière moi .... Avec cette chaleur en plus je suis mou du cerveau ... Au secours ... Est-ce que quelqu'un à l'intelligence et les connaissances suffisantes pour avoir déjà développer quelque chose de ce type

D'avance merci

Seb %-6

3 réponses

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
6 août 2003 à 18:53
API: FindFirstChangeNotification
Deja fait oui mais seulement en C.
BruNews, ciao...
0
crenaud76 Messages postés 4172 Date d'inscription mercredi 30 juillet 2003 Statut Membre Dernière intervention 9 juin 2006 28
7 août 2003 à 08:52
Voici un exemple de FindFirstChangeNotification() extrait de API-Guide et que j'ai déjà utilisé :

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_SIZE = &H8
Private Const FILE_NOTIFY_CHANGE_LAST_WRITE = &H10
Private Const FILE_NOTIFY_CHANGE_SECURITY = &H100
Private Const FILE_NOTIFY_CHANGE_ALL = &H4 Or &H2 Or &H1 Or &H8 Or &H10 Or &H100
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 FindCloseChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
Private Declare Function FindNextChangeNotification Lib "kernel32" (ByVal hChangeHandle As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function ResetEvent Lib "kernel32" (ByVal hEvent As Long) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim Ret As Long
'Set the notification hook
Ret = FindFirstChangeNotification("C:", &HFFFFFFFF, FILE_NOTIFY_CHANGE_ALL)
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the first time"
'Reactivate our hook
FindNextChangeNotification Ret
'Wait until the event is triggered
WaitForSingleObject Ret, &HFFFFFFFF
MsgBox "Event Triggered for the second time"
'Remove our hook
FindCloseChangeNotification Ret
End Sub

Christophe R.
0
osmose06 Messages postés 28 Date d'inscription samedi 29 décembre 2001 Statut Membre Dernière intervention 28 janvier 2006
23 mai 2004 à 10:16
Code sympa.

Sais-tu récupérer le nom et adresse du fichier qui a généré l'évènement.
Mon objectif est de créer un soft de synchro entre 2 PC.

@+, Pascal
0
Rejoignez-nous