CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    1,030

    How to check if a file is in use by other App in C#?

    If a file is in use, is there any way to close the file so that the file can be opened by current App? Thanks.

  2. #2
    Join Date
    Feb 2012
    Location
    Strasbourg, France
    Posts
    116

    Re: How to check if a file is in use by other App in C#?

    My idea would be to 1st find who has the handle on the file.
    And then to kill the process.

    However that's harsh as killing a process leads to unexpected results like the file being corrupted. Furthermore if a file had a handle preventing from opening there should be a reason that no other access it.

  3. #3
    Join Date
    May 2002
    Location
    Boston
    Posts
    67

    Re: How to check if a file is in use by other App in C#?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured