Hi all! i have a problem. From my database im streaming out a file and will save it with
filestream.savetostrem() method into the windows temp directory. thats work correctly. after that i open the file with the shellexecute command.
and the question: on forms close event: make a method to see all files stilled open.
i tryed this code but dosnt work:
function TInUse.IsUsed: Boolean;
var
FileHandle: HFILE;
begin
Result:=False;
if FileExists(FFileName) then begin
FileHandle:=CreateFile(PChar(FileName),GENERIC_READ or GENERIC_WRITE,0,Nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
Result:=FileHandle=INVALID_HANDLE_VALUE;
CloseHandle(FileHandle);
end;
end;
any idee?