Greg,
Sorry, I didn't mean to confuse the issue. My solution, using Dot Net,
would be first determine if the files is open (trap the error). But
what has to happen after that to close the file?
Using the MMC programatically, you could transverse the Computer
Management Counsole / Open Files, looking for all occurances of the
file and taking appropriate action to close the file.
For example, we have a process that does server file backup' s nightly.
Some of the files are .MDB's and .LDB's. Every one has gone home for
the day and they are aware of nightly maintenance. So, as one of the
"manual" steps the operator has to do before they leave is delete the
LDB's and MDB's from the Open Files list. In a seanse, they are
closing these server files before our maintnance starts.
This is where I saying the manual steps could be automated by
programatically transversing the Open Files list of the Computer
Management Counsole (v2.0) using the MMC.
Chris Dunaway wrote:
Greg Young wrote:
For file locking you would have to handle this exception anyways. The file
may not be locked when you check it but could then be locked when you try to
go to open it. The checking would however remove many instances of ther
exception. That said in this case your best best is to trap the exception as
there is no other good way of doing this, you could also use pinvoke
Just out of curiosity, do you know how other programs can determine
which processes have which files open? For example, Process Explorer
at sysinternals.com can show the processes and which files they have
open. How is this accomplished?