views:

123

answers:

1

Is there a way to get the program that is locking a file, in vb 2005?

For instance, when I try to open a file that is already opened by another program, can I get the name of the process/program that has locked this file?

+3  A: 

System Internals has a tool called Handle that you can use. It tells you which program has what file and/or directory open. It is a console application. You can pipe its output to a text file and then simply open that text file and search for the file you're looking for. Then you can see which process has it open.

c:\handle > output.txt
Mehmet Aras
You can also install ProcessExplorer from the same SysInternals Suite ( download at http://download.sysinternals.com/Files/SysinternalsSuite.zip ) and look for handles in the search box. This way you can even kill the offending process (or thread if you like living on the edge).But handle is a lot faster.
Yann Schwartz