Re: reading a opened file
- From: "snide" <nospam@work>
- Date: Tue, 27 Sep 2005 14:38:08 +0200
I finally came up with this function :
function IsFileInUse(fName : string) : boolean;
var
HFileRes : HFILE;
begin
Result := false;
if not FileExists(fName) then exit;
HFileRes :=CreateFile(pchar(fName),
GENERIC_READ, // or GENERIC_WRITE // desiredaccess
0, // sharemode
nil, // SecurityAttributes
OPEN_EXISTING, // CreationDisposition
FILE_ATTRIBUTE_NORMAL, // FlagsAndAttributes
0); // TemplateFile
Result := (HFileRes = INVALID_HANDLE_VALUE) ;
if not Result then CloseHandle(HFileRes);
end;
Denis
.
- Follow-Ups:
- Re: reading a opened file
- From: J French
- Re: reading a opened file
- References:
- reading a opened file
- From: snide
- Re: reading a opened file
- From: Fufi
- Re: reading a opened file
- From: snide
- Re: reading a opened file
- From: Maarten Wiltink
- reading a opened file
- Prev by Date: Re: Delphi and DSP
- Next by Date: Re: PLZ Simple Code To Record Wav File From Sound Card Mic Input Using MediaPlayer
- Previous by thread: Re: reading a opened file
- Next by thread: Re: reading a opened file
- Index(es):
Relevant Pages
|