Aside from using a generic method such as that suggested by RK above, it would depend on the filetype, for example Access database files (accdb) generate an associated .laccdb file when the database is open & locked (or partially locked) for writing - this file is a plain text format file which yields the PC name & Access username of the user who has the database open.
However, since most other filetypes are "single-user" files, I don't think they will generate their own accompanying lock files.