www.icetips.com  Icetips Utilities Documentation 5/9/2015    

Core Class: IsFileInUse

Previous  Top  Next  


Prototype: (String pFile),Byte

 

pFileFile name to check if it is locked and in use.

 

ReturnsReturns true or false depending on if the file is in use.

 

This method attempts to open the specified file in GENERIC_WRITE mode to see if it can be opened for writing.  If not, it is deemed in use by some other program or process.  If the file can be opened the method returns false.  A file that is in use can generally be opened for reading.  This method is very useful for operations such as deleting files or opening them with write access.  If the file is in use it can't be written to.  It is overloaded with a method that takes a *CString parameter so it can be used with both string variables and CString variables.

 

Example:

 

ITC ITCoreClass

Fn  CString(2049)

Code

Fn = ITC.EXEName

ITC.ODS('ExeName = ' & Fn)

If ITC.IsFileInUse(Fn) !! Should ALWAYS return true

  Message('This program is in use.')

Else

  Message('This program is not in use (should never happen)')

End

 

Fn = ITC.GetFilePart(ITC.EXEName,FNS_FullPath+FNS_File) & '.app'

ITC.ODS('AppName = ' & Fn)

If ITC.IsFileInUse(Fn) !! Should not be in use.

  Message('This appfile is in use.')

Else

  Message('The appfile is not in use.')

End

 

 

 

See also:

IsFolder

 

 

 



Direct link to this page: http://www.icetips.com/manuals/utilities/isfileinuse_core.htm