"Rad [Visual C# MVP]" <no****@nospam. comwrote in message
news:6o******** ******@thinkers room.com...
I beg to differ.
He asked quite explicitly *How can i tell if a file is being used(edited,
open, etc'...)* What you're saying about exclusive use may be true, but is
not what OP asked.
The presence of the lock file is a perfectly valid answer to the question
of whether the file has been opened or not.
Beg to differ all you want. His intent is clear to me. In addition to what
you quoted, he also wrote:
"If the file is not open, then my app can open the file."
and
"I also want this app to have handle to this file"
His application cannot open the file unless it's not already open by someone
else, and the only way to know whether he will be successful in opening the
file is to try doing it. Checking for the presence of a .ldb file tells him
nothing. If the file is absent, the .mdb file could still be unopenable,
and if the file is there, it's still possible that his application could
open the .mdb. The presence of the .ldb doesn't tell him anything about
whether he can actually open the .mdb file or not.
His post is clearly intended to not only find out whether the file has been
opened, but whether HIS application can open it. In any case, even if he
wants to know only whether the .mdb file is open, again...the only way to do
that is to look at that file. There is no way to atomically open one file
and create another simultaneously, and so there is no way a second file can
provide 100% accurate information about the state of another file.
Of course, neither of us will know for sure what his intent is unless he
posts and clarifies. But it's my opinion that his initial post is clear
enough, and he clearly wants access to the .mdb file. Even if he doesn't,
he can't reliably know the state of the .mdb file by looking at something
other than the .mdb file.
Pete