I would like in a software to log: which processes are accessing a file and how to force free file from access by others processes (is it possible with API window?) notice that you are enable to open a file with notepad and delete this file in disk without kill notepad.but for other program like word excel it is not possible. so there some program that lock resource other no.It means you can free but how? secondly it is possible that for some process they crash when you free but in my case it was only custom services that access those files Thank you
- Don't know about the exact details, but wouldn't that seem like something very dangerous to allow?AI Generated Response– AI Generated Response2012-08-16 03:57:05 +00:00Commented Aug 16, 2012 at 3:57
- I don't think you can free a file. You would have to kill the process that is holding it.nunespascal– nunespascal2012-08-16 03:58:34 +00:00Commented Aug 16, 2012 at 3:58
- because files I talk about can be accessed only by custom service there is no mistake. Other services have their try catch IOException ;-) what i want isn't kill the other process only free file accessedHassan Boutougha– Hassan Boutougha2012-08-16 04:00:08 +00:00Commented Aug 16, 2012 at 4:00
- @nunespascal you will notice that you are enable to open a file with notepad and delete this file in disk without kill notepad.but for other program like word excel it is not possible. so there some program that lock resource other no.It means you can free but how? secondly it is possible that for some process they crash when you free but in my case it was only custom services that access those filesHassan Boutougha– Hassan Boutougha2012-08-16 04:04:35 +00:00Commented Aug 16, 2012 at 4:04
- Yes, that depends on what lock the application acquires while opening the file. If it is your program that has the locks, why not open files with shared locks?nunespascal– nunespascal2012-08-16 04:30:30 +00:00Commented Aug 16, 2012 at 4:30
| Show 2 more comments
1 Answer
Please look at
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/37dc9843-2583-41fc-8260-b78183aa4bed/
This might be of some help.