0

I know this has already been asked... but my purpose is a bit different from the others. I don't want to process files, I just want to show a list of files, so that I can see whether the files in the list were locked by any application. This is just for the purpose of monitoring, and determining if the specific files are being held for too long by an application.

Would I have to try opening the files on each UI update iteration? Or is there a proper call to do that, that would require less resources?

I want to use as few resources as possible on this task. Otherwise, I'd just try opening the file... it could be, but I feel greedy when talking about performance, and also a like to know what tools I have to do things.

Knowing the name of the locker application is a bonus, but if possible, it is desirable.

Miguel Angelo
  • 23,796
  • 16
  • 59
  • 82
  • possible duplicate of [Delphi - finding the process that is accessing a file from my program](http://stackoverflow.com/questions/8726906/delphi-finding-the-process-that-is-accessing-a-file-from-my-program) – Sheng Jiang 蒋晟 Feb 16 '14 at 01:17
  • If tow questions have the same answer, does not mean they are dupes... but even then, the answers of the other question are talking about listing all handles, I asked about specific files. But, I can't tell those answers are pointless to my question, they could be used, but look that I want to be low on resources. – Miguel Angelo Feb 16 '14 at 01:28
  • 1
    You *really* don't want to test this by opening the files, or taking a lock of your own, or anything else that could cause failure in the process you're trying to monitor. See also: [Observer effect](http://en.wikipedia.org/wiki/Observer_effect_(disambiguation)) and [Heisenbugs](http://en.wikipedia.org/wiki/Heisenbug). – Ben Voigt Feb 16 '14 at 01:54
  • Have you tried with this: http://www.emoticode.net/c-sharp/enumerate-openlocked-file-handles-by-process.html – thepirat000 Feb 16 '14 at 02:03
  • @BenVoigt I didn't think of such an impact of this monitoring program... thanks for clarifying and expanding my view on this sort of side-effect-prone problems... one should really care if observing, is just really observing. =) – Miguel Angelo Feb 16 '14 at 02:04
  • @MiguelAngelo: Exactly. – Ben Voigt Feb 16 '14 at 02:30

0 Answers0