There is no function in the Windows API that checks if a function is open in another application. If it existed, it would be the subject of a race.
Suppose you first noted whether the file was already open and the response returned that it was not open at the moment. Then you go to open it, but in the meantime someone else has it. Then your attempt to open fails.
So the only way to find out if you can open the file is to try to do it. If the file was opened in such a way as to prevent an attempt to open it, then this attempt will fail.
source share