Results 1 to 3 of 3

Thread: How 2 know if a file is open by another program?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    100
    Hi.

    Does anyone know how to see if a file already is open by another program/computer without locking the file?

    tnx for your help.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Try this

    Not in a position to test this, but:
    Code:
    If(Dir(FileName) <> "") Then
      On Error Goto FileError
      Open FileName For Input As #1
        'whatever
      Close #1
    
    FileError:
      Msgbox "File Error - File is in use by another application"
      Exit Sub
    End If
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    100
    sorry, that wount do.. I need more controll, I have tested to use:
    Open FileName For Binary Access Read Write Lock Read Write As iFileNr
    Close iFileNr

    and that works pretty good but it takes to much power from the other program that are saving the file to the disk..

    There must be a way of reading the flagg of the file.. it must be marked "open" somewhere..

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