Quote Originally Posted by jonks View Post
How can step 2 work? - it is trying to open a locked file.
Actually I don't know... but maybe, because it's the same application and the same thread accessing the file, it can be opened after the lock. Just guessing.

However, I solved with a great "native" solution inspired by Qxt's "QxtFileLock" class (http://doc.libqxt.org/0.5.0/classQxtFileLock.html). You should check this Qxt thing out, it's really good.