Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products

Integra Script Library Documentation


Context:

Function

Library/Class:

Utilities



Function FileInUse() As

FileInUse (Filename As String) As Integer

This function checks if a particular file located in the file system is in use. It first calls the function IsMsOfficeRunning(Filename) which in turn makes some API calls looking for any MS Word or Excel task that may have the specified file in use (see IsMsOfficeRunning). If the file is in use by MS Office, the FileInUse function returns True at this point. Otherwise it will perform a low-level exclusive file access. If successful the file is not in use by any application and FileInUse returns False, otherwise True.

There are situation where MS Office temporarily closes a file that it has in use and therefore a pure low-level file access check might cause unpredictable results. That is why this function checks first for existing MS Office tasks and communicates with the task whether it has a particular file in use or not. This effect is to keep in mind when using this function on other filetypes used by different applications then MS Office, as in such case only the low-level file access will determine the FileInUse’s result.

Parameters:

    Filename (String)
      Name of the file including its path.

Return Value:
    Integer. True or False.

    Sample:
     



      Dim fnam As String
    fnam = “c:\MyDocument.doc”

    If FileInUse(fnam) Then
    Call MessageDialog(“The file “ & fnam & “ is in use”,0,”File In Use”)
    End If
     

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024