Page 1 of 1

Urgent : ZIP - some more questions

Posted: Sat Feb 06, 2010 10:01 am
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.

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 10:55 am
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

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 11:07 am
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

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 11:29 am
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

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 1:20 pm
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.

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 2:45 pm
by Richard Chidiak
Michel

with xharbour commercial you need to link

xhbzipdll.lib
xhbzip.lib

both are located in \xhb\lib

Richard

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 4:33 pm
by vensanto
Hello Driessen
i have sended to you the zip library for xharbour

Regards
Santo

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 4:46 pm
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.

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 4:50 pm
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.

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 6:40 pm
by vensanto
Hello Driessen

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

Regards
Santo

Re: Urgent : ZIP

Posted: Sat Feb 06, 2010 7:01 pm
by driessen
Santo,

Thank you very much for all your efforts.

It's working great now.

Regards,

Re: Urgent : ZIP

Posted: Mon Feb 08, 2010 10:27 am
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
 

Re: Urgent : ZIP

Posted: Mon Feb 08, 2010 2:22 pm
by driessen
Patrizio,

Thanks a lot for you suggestion.

Regards.

Re: Urgent : ZIP

Posted: Thu Feb 11, 2010 3:06 pm
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.

Re: Urgent : ZIP - some more questions

Posted: Fri Feb 12, 2010 1:21 pm
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.