Solved

Zipping a file with delphi

Posted on 2004-04-01
9
792 Views
Last Modified: 2010-04-04
I need to shell winzip and zip MyFile.exe in the windows folder

i have tried this but it dosent work..

ShellExecute(handle, PCHAR('open'), PCHAR('c:\Program Files\Winzip\winzip32.exe'),'-a -r',Windir+'\NewFile.zip',Windir+'\MyFile.exe',SW_show);

or is there code to generate  a zip file whithout using winzip in your program?
0
Comment
Question by:KLOPEKS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 2

Expert Comment

by:Ratje
ID: 10730982
U could use ZipForge from http://www.componentace.com/

Rat
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10730999
I am using a ZipForge component for Delphi from
http://www.aidaim.com/
It is a free for personal use ZIP compression library.
example:
    with ZipForge do
    try
          FileName := edt_Zip_Source.Text; // 'D:\SFX.zip';
          OpenArchive(fmCreate); // Create a new archive file
          BaseDir := edt_Folder_Source.Text; // 'D:\SFX'; // Set path to folder with some text files to BaseDir
          AddFiles('*.*');   // Add all files and directories from 'C:\SOURCE_FOLDER' to the archive
          CloseArchive; // Close the archive
    except
       // Without success
    end;
0
 
LVL 6

Expert Comment

by:BAlexandrov
ID: 10731018
Here one good free component
http://groups.yahoo.com/group/nanozip/

there is the discussion group, you can download it from files section - there are examples too.

Bojidar Alexandrov
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:Ratje
ID: 10731059
Another good choice would be turboPower Abbrevia:
http://sourceforge.net/projects/tpabbrevia/

Rat
0
 
LVL 17

Accepted Solution

by:
mokule earned 125 total points
ID: 10731098
You call with 7 parameters whilst this function takes 6.
ShellExecute(handle,
                   PCHAR('open'),
                   PCHAR('c:\Program Files\Winzip\winzip32.exe'),
                   '-a -r', // here You should pass all parameters passed to Wnzip32 (see below)
                   Windir+'\NewFile.zip',  // default directory - not zip
                   Windir+'\MyFile.exe',   // delete this line
                   SW_show);


'-a -r '+ Windir+'\NewFile.zip' + ' ' + Windir+'\MyFile.exe',
if Your MyFile.exe is already in Windir Folder
0
 
LVL 1

Expert Comment

by:FeralCTO
ID: 10732786
esoftbg,

I looked at http://www.aidaim.com/ and was unable to find ZipForge.

0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10736119
I have two accepted solutions with     http://www.aidaim.com/

01/26/2004     http://experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20862511.html

03/16/2004     http://experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20921124.html

I so sorry, I am surpised:
 http://www.aidaim.com/ is changed and there is not ZipForge anymore ????

I found version 2.51 or 2.52 at:
http://www.softandco.com/download/ZipForge/download11146.html

I am using version 2.02, I'll try a new one. I just downloaded it.

emil
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10736466
I recompiled an old application which used ZipForge 2.02 with a new version 2.52, and it works fine

  // example - ZIPPING a FOLDER 'D:\SFX'

  with ZipForge do
  begin
    if DirectoryExists('D:\SFX') then
    begin
      FileName := 'D:\SFX.zip';
      OpenArchive(fmCreate); // Create a new archive file D:\SFX.zip
      BaseDir := 'D:\SFX';      // Folder to be Zipped
      AddFiles('*.*');
      CloseArchive; // Close the archive
    end;
  end;

emil
0
 

Author Comment

by:KLOPEKS
ID: 10737387
thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question