Contents - Index - Previous - Next


FileOpenMode property

 

Applies to

TVCLZip component

 

Declaration

property FileOpenMode: Word;

 

Description

IMPORTANT: As of version 2.21, default for FileOpenMode was changed back to fmShareDenyNone as it had been for all but version 2.20.  This allows VCLZip to backup open files.  If you do not want this behavior please set FileOpenMode accordingly.  In version 2.20 the default was fmShareDenyWrite.  

 

This property allows you to define the open mode for opening files that are about to be zipped.  If a file cannot be opened with this mode, then the OnSkippingFile Event will be called to let you know that file will not be zipped because it is already open by another process, and allow you to close that file and continue. This ONLY affects the opening of files that are being zipped.  

 

The default value is (fmOpenRead or fmShareDenyNone).  This setting will allow VCLZip to backup files that are opened by other applications.  

 

You would set this property for instance if you want to be sure that VCLZip only backs up files if they are not opened by any other process at all.  In this case you would set this property as  

 

FileOpenMode :=  fmOpenRead or fmShareExclusive;  

 

From the Delphi Help File:  

The Mode parameter indicates how the file is to be opened. The Mode parameter consists of an open mode and a share mode or'ed together. The open mode must be one of the following values: 

 

Value Meaning  

fmCreate Create a file with the given name. If a file with the given name exists, open the file in write mode. 

fmOpenRead Open the file for reading only. 

fmOpenWrite Open the file for writing only. Writing to the file completely replaces the current contents. 

fmOpenReadWrite Open the file to modify the current contents rather than replace them. 

  

The share mode must be one of the following values:  

 

Value Meaning  

fmShareCompat Sharing is compatible with the way FCBs are opened. 

fmShareExclusive Other applications can not open the file for any reason. 

fmShareDenyWrite Other applications can open the file for reading but not for writing. 

fmShareDenyRead Other applications can open the file for writing but not for reading. 

fmShareDenyNone No attempt is made to prevent other applications from reading from or writing to the file. 

  

 

Run-time only