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\ 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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why not use code like this..

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

or perhaps even better...

Dim retval
retval = Shell("""" & sAddDirSep(App.Path) & "pkzip.exe""", """" & sAddDirSep(App.Path) & """"
"""" & 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
Instead of using PKZip, you should use the InfoZip library to zip files from within the program.
Check it out here:
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...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.