Solved

Zipping a file with delphi

Posted on 2004-04-01
9
785 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
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
 
LVL 2

Expert Comment

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

Rat
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now