zip

i am making a software in vb6 i wnat that the file should be zipped automatically

i have coded





Dim retval
retval = Shell("c:\itchain\pkzip.exe c:\itchain\itchain.zip c:\itchain\itchain.mdb", vbHide)

the problem here is that if the person instals in other directory than then the c:\pkzip and the c:\itchain\itchain.mdb is not found

can app.path be used


please help fast


sonalchouhanAsked:
Who is Participating?
 
autConnect With a Mentor Commented:
Instead of using PKZip, you should use the InfoZip library to zip files from within the program.
Check it out here:
http://www.cdrom.com/pub/infozip/Zip.html#Win32
You'll find a DLL file, as well as a VB demonstration project that shows you how you should implement it in your project.

This way, you don't have to worry about path problems. Also, the library supports long file names (all older version of PKZip do not). It will be faster too...
0
 
VbmasterCommented:
Why not use code like this..

Dim retval
retval = Shell(sAddDirSep(App.Path) & "pkzip.exe", sAddDirSep(App.Path) & "itchain.zip"
sAddDirSep(App.Path) & "itchain.mdb", vbHide)

or perhaps even better...

Dim retval
retval = Shell("""" & sAddDirSep(App.Path) & "pkzip.exe""", """" & sAddDirSep(App.Path) & "itchain.zip"""
"""" & sAddDirSep(App.Path) & "itchain.mdb""", vbHide)


These codes uses this small function

  Function sAddDirSep(Rad As String) As String

    sAddDirSep = IIf(Right$(Rad, 1) = "\", Rad, Rad & "\")
   
  End Function
0
 
VbmasterCommented:
Aut: do u know when it bugs out? I tried those libraries earlier but with some files it would not compress/decompress, I didn't actually bother testing it that much (I guess there's something wrong with certain filenames perhaps..) but perhaps you have tried it "a lot" and know what the problem might be?
0
 
autCommented:
VbMaster: the older version of the DLL had problems with VB (so they said when I mailed them). The newly-released version is stable, and I used it in a program I wrote with no problems at all
0
All Courses

From novice to tech pro — start learning today.