CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Simple Question

  1. #1
    Join Date
    Oct 2005
    Posts
    1

    Simple Question

    I am comparing 2 exe's together. First I took the hash code that is generated from the first exe and want to check it against another exe.

    This works ok if the exe is not inuse. As soon as I start one of the exe's and try running the hash code compare, it bombs and says

    An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll

    Additional information: The process cannot access the file "C:\file.exe" because it is being used by another process.


    Is there any way I can still read this file if it is inuse ? Its important to me that I read this file when its running.

    Any help please?

  2. #2
    Join Date
    Aug 2005
    Location
    Seattle, Wa
    Posts
    179

    Re: Simple Question

    You should be able to open it with read access whether or not it is running.
    (be sure to set FileAccess.Read)

    Code:
    Dim stream2 As Stream =  New FileStream("C:\file.exe",FileMode.Open,FileAccess.Read)

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