User Name of Process Locking File RRS feed

  • Question

  • I have been trying to find a solution for a while and cannot find something that makes sense, perhaps I am not searching properly. My apologies, if a solution is readily available. I have created an app that reads and writes a network file.  It is supposed to be used by one person at a time.  I am locking the file while it is being modified.  Now, I would like to inform the next person who tries to access the locked file not only that it is locked but also who “user name” is using the file.  Can someone show me how to get this done?  Thanks in advance.

    Friday, June 29, 2012 7:29 PM


  • I think you would need to be a network administrator in order to identify users with files open on the network. The alternative would be to create a temporary file or write the info into the file that is being edited. Of course, this would require that your app provide the proper clean-up so that the file does not appear to be open when it isn't.

    BTW, the OpenFiles utility can list open files on a machine but it does require certain permissions to run on network resources.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, June 29, 2012 8:45 PM