FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Urgent : ZIP - some more questions
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Urgent : ZIP - some more questions
Posted: Sat Feb 06, 2010 10:01 AM

Hello,

I use FWH 10.1 and the latest xHarbour Builder (Nov. 09).

I have read many topics about zip and unzip, but I have never succeeded in making a working ZIP-exe and UNZIP-exe.

Please can someone provide me with a working example? Which lib-files have to be used ?

Thank you very much in advance.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 10:55 AM
Dear Mr.Michel

Zip & Unzip functions require hbzip.lib and zlib.lib
so Should include the xHarbour Libs hbzip.lib and zlib.lib

Here is a function to extract a zip file including its folder paths

Code (fw): Select all Collapse
*------------------------------------*
Function ExtractZip(cDrive)
*------------------------------------*
Local aFiles,lOk,cDriveLetter
// Zip and Unzip functions, should include the libs named HbZip & zlib available in \xHarbour\lib
cDriveLetter:=cDrive+"\"  // For eg G:\

// Array containing the list of files in the Zip with Path
aFiles := hb_GetFilesInZip("Test.Zip") 

// The 3rd Parameter should be .T. if you need to extract contents of zip file as per Path
lOk := hb_unzipfile("Test.Zip",,.T.,,cDriveLetter,aFiles,NIL)
Return lOk


Regards
Anser
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 11:07 AM
Dear Mr.Michel,

To create a zip

Code (fw): Select all Collapse
lOk := hb_ZipFile( cTarget  , ;
                          aFiles , ;
                          nCompress , ;
                          bZip  , ;
                          lOverwrite , ;           // overwrite
                          cPassword  , ;
                          lWithPath,;               // with path
                          lWithDrive  )


Unzip
Code (fw): Select all Collapse
lOk := hb_UnZipFile( cZip        , ;
                            bOnUnZipFile  , ;
                            lWithSubDir   , ;
                            cPassword     , ;
                            cZipDir + "\" ,;
                            aFiles        ,;
                            bProgress)


http://forums.fivetechsupport.com/viewtopic.php?f=3&t=14682

Regards
Anser
Posts: 58
Joined: Thu Oct 13, 2005 01:26 PM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 11:29 AM

hello driessen,

I have build a lib for zip and unzip with xharbour pelles c

if you want, please send an e-mail that i send you

Regard
Santo

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 01:20 PM

To Santo.

Please can you send it to info@juda.be ?

Thanks a lot.

To Anser,

I tried to link hpzip.lib and zlib.lib into my application. But I use the commercial xHarbour (Builder) and I got an error "Couldn't build". I think there is a difference between the free xHarbour and the commercial xHarbour.

Any idea what now ?

Thanks a lot for your help.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 02:45 PM

Michel

with xharbour commercial you need to link

xhbzipdll.lib
xhbzip.lib

both are located in \xhb\lib

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 58
Joined: Thu Oct 13, 2005 01:26 PM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 04:33 PM

Hello Driessen
i have sended to you the zip library for xharbour

Regards
Santo

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 04:46 PM
Santo,

Thanks a lot for your e-mail.

I did some test immediately.

Unfortunately I got an error while linking :
xLINK: error: Unresolved external symbol '__chkstk referenced from winzip.lib(zip.obj)'

Did I miss something ?

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 04:50 PM
Hello everybody,

I did some test with linking the libraries xhbzîp.lib and xhbzipdll.lib.

Now I got no errors anymore while compiling and linking.

This is the test I tried :
Code (fw): Select all Collapse
ZipFiles := hb_GetFilesInZip("C:\TEST.ZIP")
hb_UnZipFile("C:\Test.Zip",,,,"C:\UNZIP\",ZipFiles,NIL)

Unfortunately, I got a GPF on the second line.

Anyone any idea why ?

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 58
Joined: Thu Oct 13, 2005 01:26 PM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 06:40 PM
Hello Driessen

this is the lib correct
http://www.veneziasoft.com/download/winzipok.zip

Regards
Santo
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Urgent : ZIP
Posted: Sat Feb 06, 2010 07:01 PM

Santo,

Thank you very much for all your efforts.

It's working great now.

Regards,

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 90
Joined: Wed Nov 07, 2007 08:56 AM
Re: Urgent : ZIP
Posted: Mon Feb 08, 2010 10:27 AM
driessen wrote:Hello everybody,

I did some test with linking the libraries xhbzîp.lib and xhbzipdll.lib.

Now I got no errors anymore while compiling and linking.

This is the test I tried :
Code (fw): Select all Collapse
ZipFiles := hb_GetFilesInZip("C:\TEST.ZIP")
hb_UnZipFile("C:\Test.Zip",,,,"C:\UNZIP\",ZipFiles,NIL)

Unfortunately, I got a GPF on the second line.

Anyone any idea why ?

Thanks.


Driessen, i have gpf too.

I've resolved with

Code (fw): Select all Collapse
   
PROC UnZipFile(cFileZip,cDir)
   LOCAL aExtract := HB_GetFilesInZip(cFileZip)
   LOCAL cFile, oErr
   FOR EACH cFile IN aExtract
      TRY
         HB_UnZipFile(cFileZip,,,,cDir,cFile,NIL)
      CATCH oErr
         DO CASE
         CASE oErr:genCode == EG_ZERODIV
         OTHERWISE
            MsgStop(oErr:Description)
            EXIT
         ENDCASE
      END
RETURN
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Urgent : ZIP
Posted: Mon Feb 08, 2010 02:22 PM

Patrizio,

Thanks a lot for you suggestion.

Regards.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Urgent : ZIP
Posted: Thu Feb 11, 2010 03:06 PM

Hello,

hb_zipfile() and hb_unzipfile() is working fine now, thanks to all the help of my FWH-friends.

But I have an additional question.

Is it possible to make an executable zip-file in FWH ?

To explain what I mean, I refer to my old DOS-period.

In those days, we had commands like PKZIP.EXE and PKUNZIP.EXE. There was also an ZIP2EXE.EXE which we could use to change a ZIP-file (e.g. TEST.ZIP) into an EXE-file (e.g. TEST.EXE). This executable could be started to UNZIP the file automatically.

I hope I was able to explain my question well.

Thanks a lot in advance for any help.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Urgent : ZIP - some more questions
Posted: Fri Feb 12, 2010 01:21 PM

Hello,

I have some more questions about hbzipfile() and hbunzipfile().

For my first question, I refer to my previous message with a question about ZIP2EXE. I'm still looking for a solution.

My second question :

How do I handle zipping files from a folder, including all the files in the subfolders ?

Thanks a lot in advance for any help.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion