ven. 02 janvier 2015, 21h59
eddymaue
atoutfox.public.association
je me mord la queud(tourner en rond) sur ce code
Bonsoir,
La seul chose que ca fait c'est détecter la modification, création et
la destruction d'un répertoire dans un dossier cible
bref ca fait tout sauf ce que je veux
la création d'un fichier
si vous avez une idée
a+ eddy
Declare_api()
* Only the second constant is demonstrated in this
* example; the others are listed for convenience.
* A file has been created, renamed or deleted.
#Define FILE_NOTIFY_CHANGE_FILE_NAME 0x1
* Directory has been created, renamed or deleted.
#Define FILE_NOTIFY_CHANGE_DIR_NAME 0x2
* A file's attribute (archive, read-only) has been changed.
#Define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x4
* A file's size has changed.
#Define FILE_NOTIFY_CHANGE_SIZE 0x8
* A file's last write data has changed.
#Define FILE_NOTIFY_CHANGE_LAST_WRITE 0x10
* A security descriptor for a directory or file has been changed.
#Define FILE_NOTIFY_CHANGE_SECURITY 0x100
* Look for any changes - bitwise OR these values together.
#Define FILE_NOTIFY_ALL = FILE_NOTIFY_CHANGE_ATTRIBUTES Bitor ;
FILE_NOTIFY_CHANGE_DIR_NAME Bitor ;
FILE_NOTIFY_CHANGE_FILE_NAME Bitor ;
FILE_NOTIFY_CHANGE_LAST_WRITE Bitor ;
FILE_NOTIFY_CHANGE_SECURITY Bitor ;
FILE_NOTIFY_CHANGE_SIZE
#Define INVALID_HANDLE_VALUE -1
#Define INFINITE 2147483647
#Define WAIT_FAILED 2147483647
#Define True -1
#Define False 0
lcPathSpec = "C:\TEST1"
lbWatchSubtree = True
* Watch for a directory added, changed or deleted beneath the
* specified PathSpec.
lihNotify = FindFirstChangeNotification(lcPathSpec, lbWatchSubtree, ;
FILE_NOTIFY_CHANGE_DIR_NAME)
If lihNotify <= INVALID_HANDLE_VALUE
Messagebox ("FindFirstChangeNotification failed. Error code: " + ;
LTRIM(Str(GetLastError())))
Return
Else
* Uncomment for debugging purposes.
* MessageBox ("FindFirstChangfeNotification instantiation ;
* succeeded. Handle is: " + ltrim(str(lihNotify)))
Endif
* Now, go into a wait state.
* This is going to look like a hang, since the IDE is all in
* one thread.
liWaitReturn = WaitForSingleObject(lihNotify, INFINITE)
If liWaitReturn >= WAIT_FAILED
Messagebox ("WaitForSingleObject failed. Error is: " + ;
LTRIM(Str(GetLastError())))
Return
Else
Messagebox ("Directory change in " + lcPathSpec + " occurred"
+Chr(13)+"lihNotify = "+Transform(lihNotify))
Endif
* lihNotify = 1592 .... repertoire renommé
* lihNotify = 1362 .... repertoire crée
liWaitReturn = FindCloseChangeNotification(lihNotify)
*
/¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Declare_Api
* / Eddy Maue a+ -- Créer le : 2015-01-02
Procedure Declare_api
Declare Long WaitForSingleObject In kernel32 ;
INTEGER hHandle, ;
INTEGER dwMilliseconds
Declare Long FindFirstChangeNotification In kernel32 ;
STRING lpPathName, Integer bWatchSubtree, Integer dwNotifyFilter
Declare Long FindNextChangeNotification In kernel32 ;
INTEGER hChangeHandle
Declare Long GetLastError In kernel32
Declare Long FindCloseChangeNotification In kernel32 ;
INTEGER hChangeHandle
Endproc && Declare_Api
--
Merci de partager avec moi votre immense savoir que je me ferai plaisir
d'absorber...
il va de soi que je vais vous en laisser un peu
Politesse et savoir vivre oblige ;0)
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000015632