Click here to Skip to main content
15,885,760 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
COULD THAT BE DONE USING FILESYSTEM WATCHER ? IF YES , HOW ? IF NO THEN WHAT ELSE TO DO ?
Posted
Updated 18-Aug-14 0:59am
v2
Comments
keyur chauhan 18-Aug-14 9:17am    
is it that hard ?? just to check if a particular directory was just opened or not ? cause even i've been google-ing it for last 4-5 hours but still cant find any convenient source

1 solution

yes, FileSystemWatcher may help you - there are plenty of articles around on how to use it - the biggest issue is catching multiple events for one file - and you may need to wait until the opening application has finished/closed the file, so you may need a delay

AND STOP SHOUTING !! all caps is rude
 
Share this answer
 
v2
Comments
keyur chauhan 18-Aug-14 7:28am    
i have checked all the properties and events of filesystem watcher but could not find a way through !!
Garth J Lancaster 18-Aug-14 8:12am    
sorry - I see your point - having trawled through the docco, detecting file opened is pretty near impossible using an api - even ReadDirectoryChangesW wont do it

how about this .. if its always the same directory, at time-0, get and store a list of files and their last-modified timestamp. At time-n where n is a delay you might have to experiment with, scan the directory, compare the last modified dates with the list from time-0, and if a last modified date has changed, its (a possibility) that the file has been opened
keyur chauhan 18-Aug-14 8:35am    
yess the folder is the same , but the thing i want to do is , when a user tries to open that folder say @c\desktop\temp he should get a pop up windows asking for a correct password ,meanwhile that folder should be locked , and if the user enters the correct password the folder is unlocked and opened up .
Google says i should try shell extensions but i am kinda non-familier with those things

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900