?
Solved

Zipping a file with delphi

Posted on 2004-04-01
9
Medium Priority
?
794 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
Industry Leaders: 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 500 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 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