FLock

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

FLock

Declaration

function FLock: WordBool;

Description

Locks the current table.

Return Value

True if the lock was successful and False if not. In Windows, SHARE.EXE should be loaded at the work station in order to achieve consistent file lock results.

 

Apollo will retry locks according to the time-out value set via SetLockTimeout before returning a lock failure.

Delphi Example

// Reindex example

with ApTbl do

begin

 Open; 

 IndexOpen( 'c:\Apollo\sxlog1.ntx' ); 

 IndexOpen( 'c:\Apollo\sxlog2.ntx' ); 

 

 if FLock then

 begin 

         SetGaugeHook( Gauge1.Handle ); 

         // Global to set gauge proportion

         GaugeFiles := 2;  

         Reindex; 

         SetGaugeHook( 0 ); 

         Unlock( 0 ); 

 end 

 else 

         ShowMessage( 'Lock failed. Try again later.' ); 

end;

See Also

Locked, RLock, SetLockTimeout, Unlock