Ross Levis wrote: > Further to this problem, I discovered it has nothing to do with > operating systems or Delphi versions. > > I discovered that the hex editor I was looking at the file with was > preventing the file from being truncated by my app. I'm guessing the > editor is opening the file in a shared read/write mode and even though > my app can open the file in readwrite mode, it cannot truncate it if > it's open by the editor. That is rather dangerous in my situation and I > would rather not be able to open the file except in readonly mode in > this situation. > > Is there a simple way to check if the file is open by another app in > readwrite or write mode? I don't need to know if the file is open in > read mode by another app as this appears to work fine when truncating.
The only way I know to do this is to attempt to open the file with fmShareDenyWrite. If another process already has the file open with Write capability, the open attempt should fail with a file I/O exception. HTH Stephen Posey [EMAIL PROTECTED] _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

