Click here to Skip to main content
15,867,895 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How can i release the file handle which is held open by OS ?
I know how to create a file handle through OpenProcess() but it creates a different handle and then i'm able to close it but the handle held by OS is still open. I need to release it.
Posted
Comments
Jochen Arndt 2-Aug-13 6:11am    
You can not close a handle that is owned by another process.
sheetal dahiya 2-Aug-13 6:13am    
But then how does s/w like File unlocker works?
I just need to unlock the file .
Jochen Arndt 2-Aug-13 6:31am    
OK, you can, but you should not do so (especially when the process belongs to the OS).

Most unlock programs simply close the application that holds the handle.

If you don't need sources, you can use the command line utility handle.exe from the SysInternals suite: http://technet.microsoft.com/en-US/sysinternals/bb896655.aspx
sheetal dahiya 2-Aug-13 6:53am    
i'm making my own application .
i need a function to release the handle.
Jochen Arndt 2-Aug-13 6:56am    
You can execute handle.exe from your app.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900