windowssimulatefilelock

How can I simulate a "locked" file (one which has a write lock)


I am trying to debug a problem where users occasionally have locked files which they try to open. The code appears to have correct exception handling but users are still reporting seeing error messages. How can I simulate a locked file so that I can debug this myself?

EDIT: For Windows.


Solution

  • depends, but in case, MS word locks
    if you are wonderig if your application lock files and it do not relase locks:
    just modify a bit your aplication (to create a testapp) and never close the file (and keep it runnig)