Re: Try..Except fails. Also - any other ways?
- From: "AdamMaynard24" <adammaynard24@xxxxxxxxxxx>
- Date: 27 Jul 2006 01:25:13 -0700
So without compilation and recrashing my application - what made you
determine the mode? this bitwised 'or'ed values - do you just kind of
guess from the individual functionality of each mode value that when
or'ed together they will combine their ability?
Mainly though - the fmShareExlusive states: Other applications can not
open the file for any reason.
What happens if this is already open by another application.. as is the
case - you see, the file i'm testing on - a log file, is getting logged
to by another application, but you can open this file with Notepad. It
just means you cannot save the file becaues it is currently in use by
another program (and if closed and reopened, it will have a whole new
buffer of log in it that was being created while you were viewing it).
This is of course fine. I'm just wanting to get the size of the file
that's being used with the TFileStream using this method, and not have
it fail, or if it does fail - for this to be handled.
Btw - Any ideas why the catch-all exception handling didn't work either
though? I suppose there could be no exception created for such an
occurance..
THanks, Adam.
J French wrote:
On 26 Jul 2006 21:50:39 -0700, "AdamMaynard24"
<adammaynard24@xxxxxxxxxxx> wrote:
I'm trying to load a log file into a TFileStream, but the problem is, I
don't have a way of checking if the log file is being used by another
application. Any ideas? I thought catching all exceptions would work:
I would use FileOpen
Then, if successful pass the Handle to a THandleStream
You will get a 'bad' Handle -1 if FileOpen fails
The mode you need is : fmShareExclusive Or fmOpenRead
.
- Follow-Ups:
- Re: Try..Except fails. Also - any other ways?
- From: alanglloyd@xxxxxxx
- Re: Try..Except fails. Also - any other ways?
- References:
- Try..Except fails. Also - any other ways?
- From: AdamMaynard24
- Re: Try..Except fails. Also - any other ways?
- From: J French
- Try..Except fails. Also - any other ways?
- Prev by Date: Re: Try..Except fails. Also - any other ways?
- Next by Date: Re: Delphi and Singular value decomposition
- Previous by thread: Re: Try..Except fails. Also - any other ways?
- Next by thread: Re: Try..Except fails. Also - any other ways?
- Index(es):
Relevant Pages
|