#1
|
||||
|
||||
![]()
is there any way to check if a file is in use via inno setup?
|
Sponsored Links |
#2
|
||||
|
||||
You need to open the file with the intent to both read and writing to it, if this operation fails then it means the file is in use.
Code:
function IsFileInUse(Filename: String): Boolean; begin Result := False; try with TFileStream.Create(Filename,fmOpenReadWrite) do // this should fail try finally Free; end; except Result := True; // this handles the exception and tells you the file is in use end; end; Last edited by Razor12911; 19-12-2021 at 20:47. |
The Following User Says Thank You to Razor12911 For This Useful Post: | ||
Cuttlas (21-12-2021) |
#3
|
||||
|
||||
![]()
what happens if the file is so big? does it take too long?
|
#4
|
||||
|
||||
Size is irrelevant
|
#5
|
||||
|
||||
@Razor12911, Just curiosity...
Is it necessary to use "try" "finally"? It could not be used simply "do Free;" |
#6
|
||||
|
||||
You can write "do Free", it's the same thing only for this case as there is no code within the try..finally statement that would cause an exception.
|
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Borderlands 2 GOTY | omdj | PC Games - CD/DVD Conversions | 11 | 22-01-2021 08:22 |
Useful Dll for Inno Setup users | peterf1999 | Conversion Tutorials | 88 | 01-12-2017 16:00 |
Midway Arcade Treasures 2 | kartking | CD/DVD Copy Protections & Utilities | 5 | 19-11-2007 08:19 |
HELP ME PLZ!!!! | Dalvin | DC Games | 0 | 02-01-2001 22:14 |