In this forum until today I was always a "taker". Now I think its time to change my behavior.
1. Download MoleZip.dll form 2. Register it with RegSvr32
3. Now you can call BackupDatabase( cDatabase, lSilent )
4. BackupDatase is using another function OpenDatabaseExclusive( cDatabase ). There I try to open the database exclusive, to be sure, no one else is using the database.
This function you have to write yourself
*********************************************
* BackupDatabase
*********************************************
FUNCTION BackupDatabase( cDatabase, lSilent )
LOCAL oZip, cFName, cTime, cDir, nRow, nAnz
LOCAL nTotalSize
LOCAL ARRAY aMyArray(1)
cTime = TIME()
cFname = DTOS(DATE()) + "-" + SUBSTR(cTime,1,2) + SUBSTR(cTime,4,2) + ".zip"
cDir = SYS(2003) && current dir
* Calculate TotalSize: later a Progressbar will show the status
CD DATA
nAnz = ADIR(aMyArray)
nTotalSize = 0
FOR nRow = 1 TO nAnz
nTotalSize = nTotalSize + aMyArray(nRow,2)
ENDFOR
CD ..
*----
IF !OpenDatabaseExclusive( cDatabase )
RETURN
ENDIF
CLOSE DATABASES ALL
oZip = CREATEOBJECT("MoleZip.ZipFile")
oZip.CREATE(cFname)
CD DATA
FOR nRow = 1 TO nAnz
oZip.PackInplace(aMyArray(nRow,1),aMyArray(nRow,1),6)
ENDFOR
oZip.CLOSE()
CD ..
OPEN DATABASE (cDatabase) SHARED
OpenMyTables()
IF !lSilent
MESSAGEBOX("Backup FileName is " + cFName ",0, gcPrg_Version)
ENDIF
ENDFUNC
1. Download MoleZip.dll form 2. Register it with RegSvr32
3. Now you can call BackupDatabase( cDatabase, lSilent )
4. BackupDatase is using another function OpenDatabaseExclusive( cDatabase ). There I try to open the database exclusive, to be sure, no one else is using the database.
This function you have to write yourself
*********************************************
* BackupDatabase
*********************************************
FUNCTION BackupDatabase( cDatabase, lSilent )
LOCAL oZip, cFName, cTime, cDir, nRow, nAnz
LOCAL nTotalSize
LOCAL ARRAY aMyArray(1)
cTime = TIME()
cFname = DTOS(DATE()) + "-" + SUBSTR(cTime,1,2) + SUBSTR(cTime,4,2) + ".zip"
cDir = SYS(2003) && current dir
* Calculate TotalSize: later a Progressbar will show the status
CD DATA
nAnz = ADIR(aMyArray)
nTotalSize = 0
FOR nRow = 1 TO nAnz
nTotalSize = nTotalSize + aMyArray(nRow,2)
ENDFOR
CD ..
*----
IF !OpenDatabaseExclusive( cDatabase )
RETURN
ENDIF
CLOSE DATABASES ALL
oZip = CREATEOBJECT("MoleZip.ZipFile")
oZip.CREATE(cFname)
CD DATA
FOR nRow = 1 TO nAnz
oZip.PackInplace(aMyArray(nRow,1),aMyArray(nRow,1),6)
ENDFOR
oZip.CLOSE()
CD ..
OPEN DATABASE (cDatabase) SHARED
OpenMyTables()
IF !lSilent
MESSAGEBOX("Backup FileName is " + cFName ",0, gcPrg_Version)
ENDIF
ENDFUNC