Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 1 Monat
Letzter Beitrag:
vor 2 Jahren
Beteiligte Autoren:
Ned!, Alexandre Leclerc

[WD21] Check if file is locked

Startbeitrag von Ned! am 20.06.2016 09:34

Hi All,

I am looking for a method to check whether a file (external file - jpg etc, not a HF file) is locked by another application.

Does anybody know a function that might be useful?

I have tried fLock and fOpen, but they only seem to work with txt files. Does anybody have any ideas?



Hi Ned,

As far as I know there is no sure way in Windows to know if a file is being used by another application or not. This is why, Microsoft itself, and many other applications, use their own file lock mechanism (usually as MS Office does: an invisible file with the same name and a slight change to the file extension with a ~).

Note that fLock must also be used by the other application, otherwise it will not work. i.e. you will not know if it is locked. The other application must also keep the file open, which is a very rare case. Etc. There are many things to check...

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 21.06.2016 12:50
Hi Alexandre,

Thanks for your insight.

I managed to workaround the locked file by copying it to another directory - I could then work with it as normal.


von Ned! - am 22.06.2016 13:08
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.