Reputation: 586
When you try to delete a file in Windows Explorer, and that file is in use, it brings up a dialog saying File In Use and it proceeds to give you the file name that has the file open.
For example,
I've seen hacks involving kernel drivers, but if Windows Explorer can do it, then there must be an easier way.
What is the best and easiest way to get this information?
Upvotes: 3
Views: 469
Reputation: 136391
Starting with windows vista you can use the IFileIsInUse
interface, if you want support older versions of windows you can use the NtQuerySystemInformation, NtQueryInformationFile and NtQueryObject WinApi functions, for more infomation about this topic check my answer on this question.
Upvotes: 6