When you open the file in your application using FileStream or any similar class you have option of opening it in SharingMode or not. If you open it in SharingMode file will not be locked. If you open it in Non-Sharing mode, file will be locked.
Let me know if that is what you were looking for.