unlock file

sometimes when i delete a file, a messagebox comes up and telling me something like "could not delete the file because it is used by an other application". how can i retrieve the filehandle and release it? (so i can be able to delete it)

sorry for the small amount of points, but that's all i have :)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think you can delete a file (in use) only if you first shut down the application that uses it. Theoretically speaking, there could be another way - a low level way to delete a locked file, but it would not be advisable, because such interference can result in some serious system malfunction (Access Violations, halts and crushes).

ZhaawZSoftware DeveloperCommented:
You may use WhoLockMe to get info about processes that use some specific file:
check also this neat cmdline tool: http://www.sysinternals.com/Utilities/Handle.html

as for a "programmic solution" i think it raids into any open process via dll-injection, but im not sure how this turns out full. at least in this direction one is able to associate the PID to a (file)handle.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.