Anybody any ideas to close a file which is used from another user with VB (like "net file ID /close function").
thanks for all information
jo
Printable View
Anybody any ideas to close a file which is used from another user with VB (like "net file ID /close function").
thanks for all information
jo
Assuming this is on a local machine:
If a different process has a file open, you can't close the file from your process. You have to get rid of the other process.
See this thread for various ideas on process termination.
If the file was left open by abnormal termination of the other process, then your only solution is to reboot. This is because the lock on the file remains in effect, even though the process is no longer there. If you use one of the methods in the above thread, no locks will remain after the process is gone.
The reason "net fileID close" works is because you're closing a file opened remotely on a server. Browser manager actually has the file lock, and responds to this function. Regular processes can't do that without extensive programming.
:)
Maybe MS should implement a WM_LETGOTHATFILE message.