Urgent : ZIP - some more questions

Post Reply
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Urgent : ZIP - some more questions

Post by driessen »

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.
Last edited by driessen on Fri Feb 12, 2010 1:19 pm, edited 1 time in total.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Urgent : ZIP

Post by anserkk »

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: Select all

*------------------------------------*
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
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Urgent : ZIP

Post by anserkk »

Dear Mr.Michel,

To create a zip

Code: Select all

lOk := hb_ZipFile( cTarget  , ;
                          aFiles , ;
                          nCompress , ;
                          bZip  , ;
                          lOverwrite , ;           // overwrite
                          cPassword  , ;
                          lWithPath,;               // with path
                          lWithDrive  )
Unzip

Code: Select all

lOk := hb_UnZipFile( cZip        , ;
                            bOnUnZipFile  , ;
                            lWithSubDir   , ;
                            cPassword     , ;
                            cZipDir + "\" ,;
                            aFiles        ,;
                            bProgress) 
http://forums.fivetechsupport.com/viewt ... =3&t=14682

Regards
Anser
User avatar
vensanto
Posts: 54
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA
Contact:

Re: Urgent : ZIP

Post by vensanto »

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
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Urgent : ZIP

Post by driessen »

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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: Urgent : ZIP

Post by Richard Chidiak »

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
User avatar
vensanto
Posts: 54
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA
Contact:

Re: Urgent : ZIP

Post by vensanto »

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

Regards
Santo
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Urgent : ZIP

Post by driessen »

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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Urgent : ZIP

Post by driessen »

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: Select all

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.
Last edited by driessen on Sat Feb 06, 2010 4:51 pm, edited 1 time in total.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
vensanto
Posts: 54
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA
Contact:

Re: Urgent : ZIP

Post by vensanto »

Hello Driessen

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

Regards
Santo
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Urgent : ZIP

Post by driessen »

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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Patrizio
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy
Contact:

Re: Urgent : ZIP

Post by Patrizio »

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: Select all

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: Select all

   
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
 
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Urgent : ZIP

Post by driessen »

Patrizio,

Thanks a lot for you suggestion.

Regards.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Urgent : ZIP

Post by driessen »

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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Urgent : ZIP - some more questions

Post by driessen »

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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Post Reply