Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BindEvent and the File System
Message
De
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:
01388798
Vues:
78
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 ;
			)
>The last 2 parameters make it asynchronous. I'm not sure if it can be done in VFP though.
>
>>WIth the aid this function I almost have what I want. The only thing I am having trouble with is this functions waits until some file activity occurs. I have tried to make it asynchronous, but I guess in am not setting the arguments correctly. There are very little in examples on the web that are not written C++. A vb or vfp example would probably help.
>>
>>
>>>ReadDirectoryChangesW Win API function monitors a directory and returns a reason http://www.news2news.com/vfp/?group=27&function=628
Greg Reichert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform