Link to home
Start Free TrialLog in
Avatar of sonalchouhan
sonalchouhan

asked on

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


Avatar of Vbmaster
Vbmaster

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
ASKER CERTIFIED SOLUTION
Avatar of aut
aut

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
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