Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my application, i used hotfolder. while enabling hotfolder this folder will shows(share) to all network systems. Network pc user paste some file in this folder(hotfolder), it will come to my application. but user enable windows preview pane to hotfolder, that time preview will take the file handle because of that file is not reached to my application. i want to disable windows preview pane for my hotfolder folder.

What I have tried:

i tried to close preview handle but i can not able to do.
Posted
Updated 29-Nov-17 4:50am
Comments
F-ES Sitecore 29-Nov-17 5:28am    
Let's say you disable the preview pane, what if I open the file in notepad which will also lock it, are you going to disable notepad? What if I open it in Word or GIMP or Excel, are you going to disable all of those too?

You can't stop users getting locks on files.

1 solution

You can't. Well, you could but then the user can just turn it back on and you can't stop that.

Like was already stated in the comments, you can't stop a user from opening the file and reading it. Hell, even just copying the file opens it with an exclusive lock.

Your code has to be written to be tolerant of the file being locked, showing an error dialog if it is. You could even have the code just wait a bit and retry opening the file.

It's up to you, but preventing a user from doing something on their own machine is NEVER the answer to fixing a problem.
 
Share this answer
 

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