Delete a file in use in runtime

后端 未结 4 1735
南旧
南旧 2021-01-23 11:31

How to delete a file which is in use/open by some process in runtime. I am using vb.net for my project and a image is shown in picturebox, and that should be deleted, without cl

4条回答
  •  面向向阳花
    2021-01-23 11:53

    You can close the proccess down, then delete it, or delete on reboot. Use the above suggestions for information on using MoveFileEx() with Windows.

    To close down a process you can do the following:

    For Each proc As Process In System.Diagnostics.Process.GetProcessesByName("process name here")
    proc.Kill()
    Next
    

提交回复
热议问题