Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BindEvent and the File System
Message
 
 
À
17/03/2009 15:17:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Divers
Thread ID:
01388378
Message ID:
01388805
Vues:
83
I'm not sure what WaitForSingleObject() has to do with ReadDirectoryChangesW. You open directory once with CreateFile() and than monitor with repeated calls to ReadDirectoryChangesW().
Don't forget to use CloseHandle() function to close the handle when you done.

>Yes, but after some research I find the asynchonous aspect is not what I am looking for. I am using the WaitForSingleObject to detect if a message is needed to be read, the CreateFile function to get a handle to the folder(s), and then the ReadDirectoryChangesW to get the file information. All appears to work as expect except by the time the ReadDirectoryChangesW function is called, the message is gone. The function waits for the next file activity before returning. I suspecting that either the WaitForSingleObject or the CreateFile function is marking the message as read. Therefore by the time the ReadDirectoryChangesW is called, the message is gone. Any ideas?
>
>
>		lcSearchPath = STRTRAN(THIS.PathBeingWatched,[\],[\\]) + CHR(0)
>
>		#DEFINE kAccess		0	&& GENERIC_ALL
>		#DEFINE kShare 		FILE_SHARE_READ + FILE_SHARE_WRITE + FILE_SHARE_DELETE
>		#DEFINE kCreate		OPEN_EXISTING
>		#DEFINE kFlag		FILE_FLAG_BACKUP_SEMANTICS
>
>		#DEFINE kChangeSetting ;
>			FILE_NOTIFY_CHANGE_FILE_NAME ;
>			+ FILE_NOTIFY_CHANGE_DIR_NAME ;
>			+ FILE_NOTIFY_CHANGE_ATTRIBUTES ;
>			+ FILE_NOTIFY_CHANGE_SIZE ;
>			+ FILE_NOTIFY_CHANGE_LAST_WRITE ;
>			+ FILE_NOTIFY_CHANGE_CREATION
>
>		hDirectory= CreateFile( lcSearchPath ;
>			,kAccess ;
>			,kShare ;
>			,0 ;
>			,kCreate ;
>			,kFlag ;
>			,0 ;
>			)
>
>		llResult = ReadDirectoryChangesW( hDirectory ;
>			,@lcBuffer;
>			, 1024;
>			, 1;
>			, kChangeSetting;
>			, @lnCount;
>			,0;
>			,0 ;
>			)
>
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform