Solved

big problem

Posted on 2001-08-05
53
253 Views
Last Modified: 2010-04-06
hello,
i whant to pack(zip) a file (like winzip or ader programmes). but i don't know how i can do that. and i thought maybe someone has a componet for it? or something eles?
plz help.

Carlos Smith
0
Comment
Question by:krydea
  • 25
  • 18
  • 4
  • +4
53 Comments
 
LVL 22

Expert Comment

by:mnasman
ID: 6352864
0
 
LVL 21

Expert Comment

by:gemarti
ID: 6352875
here is the code to the test.pas unit that demonstrates the zlib component that ships as an extra with Delphi

look for zlib.pas on D4,D5, or D6.

program Test;

uses Classes, SysUtils, ZLib;

const
  BufferSize = 4096;
 
type
  TTest = class
    InFile: TStream;
    OutFile: TStream;
    ZStream: TCustomZLibStream;
    Buffer: array[0..BufferSize-1] of Byte;
    procedure Expand;
    procedure Shrink;
    procedure Status(Sender: TObject);
  end;

procedure TTest.Shrink;
begin
  InFile := TFileStream.Create('c:\work\temp\test.pas', fmOpenRead);
  try

    OutFile := TFileStream.Create('c:\work\temp\test.dat', fmCreate);
    try

      ZStream := TCompressionStream.Create(clFastest, OutFile);
      try
        TCompressionStream(ZStream).OnProgress := Status;
        ZStream.CopyFrom(InFile, 0);
      finally
        ZStream.Free;
      end;

    finally
      OutFile.Free;
    end;
  finally
    InFile.Free;
  end;
end;


procedure TTest.Expand;
var
  Count: Integer;
begin
  InFile := TFileStream.Create('c:\work\temp\test.dat', fmOpenRead);
  try

    OutFile := TFileStream.Create('c:\work\temp\test.new', fmCreate);
    try

      ZStream := TDecompressionStream.Create(InFile);
      try
        TDecompressionStream(ZStream).OnProgress := Status;
        while True do
          begin
            Count := ZStream.Read(Buffer, BufferSize);
            if Count <> 0 then OutFile.WriteBuffer(Buffer, Count) else Break;
          end;
      finally
        ZStream.Free;
      end;

    finally
      OutFile.Free;
    end;
  finally
    InFile.Free;
  end;
end;

procedure TTest.Status(Sender: TObject);
begin
  Writeln(TCustomZLibStream(Sender).Position);
end;

var
  T: TTest;
begin
  T := TTest.Create;
  try
    T.Shrink;
    T.Expand;
  finally
    T.Free;
  end;
  Readln;
end.



GEM
0
 

Author Comment

by:krydea
ID: 6352879
mnasman : is there a free one?
gemarti : i don't understand are you saying that in my delphi 5 is aready a comonent for that<- i got enterprice or is it hidden? plz explane.
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6352883
krydea
 
  yes there are some free on
 
  Look at PowerArc Libaray, it's good and fast, and FREE, go to this page to see and download it
http://softlab.od.ua/products/powerarc/index.html

Mohammed

0
 
LVL 21

Expert Comment

by:gemarti
ID: 6352884
Well I have professional versions. Since Enterprise is the full package I'd bet they included the source code.

Look in the folder [cdrom drive]\info\extras\zlib.

:)

GEM
0
 

Author Comment

by:krydea
ID: 6355696
mnasman : i will give you the point's if you can give me a example of the fastesed way to conpress something and the highest way to conpress something. can you do that?

gemarti : sorry but i think i will you mnasman his comment.
0
 

Author Comment

by:krydea
ID: 6355871
can you plz do that?
0
 

Author Comment

by:krydea
ID: 6361014
mnasman : do i need those dll on the comuter were i use the powerarc stuff?
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6363290
Hello

  Look at QuickZip,
http://qzip.cjb.net

it's program like winzip, but support many type of compressed files, it's build on "Common Archiver Kit", you can download it for free, look at download page
http://quickzip.ifroggy.com/quickzip/downloads.php

but it's need also for some dlls to installed, it's come with demo to compress and uncompress the compressed files


0
 
LVL 22

Expert Comment

by:mnasman
ID: 6363610
Hello

 krydea, give me ur email, or send me email at nasman@mogaza.org, and i will send you demo with source for zip and unzip files with delphi

0
 
LVL 4

Expert Comment

by:jsweby
ID: 6364335
I use the CAB File component from TMS Software (www.tmssoftware.com) which, although it doesn't actually create PKZip files, creates CAB files and LZX files which are better compressed than Zip files.

J.
0
 

Author Comment

by:krydea
ID: 6365777
mnasman : can you plz give me links so i can donload stuff i dont understand this i'm only 14:p
0
 

Author Comment

by:krydea
ID: 6367155
krydea@hotmail.com
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6370055
I sent u email with the project
0
 

Author Comment

by:krydea
ID: 6376355
does someone know a free compressor without(<-always welcome but does not have to be) source and withoud dll.

plz help.
Ps: this question is harder then i thought so i will set the point's on 200.
0
 

Expert Comment

by:Yevgen
ID: 6376394
Here's something to overload you brain:

www.datacompression.com
0
 

Expert Comment

by:Yevgen
ID: 6376395
Oh, sorry that is a stupid site...

This is the one: www.data-compression.com
0
 

Author Comment

by:krydea
ID: 6376417
are the points to low to give me some download links?;)
umm..wait i will look on www.delphipages.com
0
 

Author Comment

by:krydea
ID: 6376430
there is notthing..
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6376762
krydea, like I told you before

  if you want a free components to compress you will find them come with some dll, but if you can buy one look at these sites:
http://www.turbopower.com/products/Abbrevia
http://www.xceedsoft.com/products/ZipCompL/index.htm

also there are some others look at

http://delphi.about.com/cs/vclcompression/index.htm


Mohammed
0
 

Author Comment

by:krydea
ID: 6376961
i'm 15 years old do you realy thing i can get that kind of monney?
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6377034
maybe you are rich :o)
just kidding krydea

If you know the c++ i can send you the source of zip.dll and unzip.dll, the source avalible in C

there are some programs built with zip and unzip dlls, that I sent you to like
http://www.filzip.com/en/index.html
http://qzip.cjb.net



0
 

Author Comment

by:krydea
ID: 6377048
thanx. i will donloading the c sourcecode.
0
 

Author Comment

by:krydea
ID: 6377052
umm sorry but i can find the source code's.... can you maybe mail them to..?
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6399749
krydea
I sent you the source code from few days
have u got it?
0
 

Author Comment

by:krydea
ID: 6400796
yes but i still can get it to work..:(
did you ever looked on www.planetsourcecode.com?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:krydea
ID: 6489982
i still can't fint a **** that work's good....
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6490235
krydea, as i told you, there's no free Zip and unzip components without dll, as i know
why u dont' want the dlls?
you can distrbute them with ur project using installshield, so the user will not feel there's another files
0
 

Author Comment

by:krydea
ID: 6490346
k,
do you have then a fast and good working compresing with dlls?
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6490454
Look for Delphi Zip v.1.6L By Eric W. Engler
http://www.torry.net/compressstd.htm
or download it dirctly for this link
http://www.torry.net/vcl/compress/std/dzbcb.zip

it's come with good demo files, and there's some programs made with this component
0
 

Author Comment

by:krydea
ID: 6540685
doesn't winzip geve anny dll's?
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6560171
Look in winzip directory, and you will find 7 dlls
0
 

Author Comment

by:krydea
ID: 6560720
can you give me the link?
or do you mean on my computer?
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6562394
in your computer
look in the winzip folder and u will find the dll's in it, in ..\Program Files\winzip
0
 

Author Comment

by:krydea
ID: 6569165
k,
i'm gana look but how do i know what the function's are i have to call?
0
 

Author Comment

by:krydea
ID: 6569178
i found:
WZSHLSTB.DLL        
WZSHLEX1.DLL        
WZCAB3.DLL        
WZVINFO.DLL        
WZZPMAIL.DLL      
WZ32.DLL      
WZCAB.DLL      
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6615885
so winzip use dlls, so it's not bad to include dlls with ur application, use install shield or other installtion programs to help you to install ur program with the dlls, the user will not know or annoy of the dlls
0
 

Author Comment

by:krydea
ID: 6629452
i know.. but what are the dll functions:s...
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6639408
I'm not the programmer of winzip to know that ;)

if you want to Integrating Winzip to your Applications look at
http://www.borland.com/delphi/news/delphi_developer/vicaria/
http://www.undu.com/Articles/991208d.html
http://www.delphi32.co.yu/preuzeti_tekstovi/integrate_winzip.htm
0
 

Author Comment

by:krydea
ID: 6641764
so you can explane?
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6643970
read the links :o)
0
 

Expert Comment

by:amp072397
ID: 6789794
krydea:

Just a friendly reminder to return to this open question.

thanks!
amp
community support moderator
0
 

Author Comment

by:krydea
ID: 7140210
:s
k sorry i forgot about it.. and those links doesn't work:S
0
 
LVL 22

Expert Comment

by:mnasman
ID: 7167490
most of the links i gave to you working fine :)
0
 
LVL 39

Expert Comment

by:abel
ID: 7214096
Only the Borland link doesn't work anymore...

If you want to use the dlls instead of the commandline util from Nico Mak's Winzip, you should look into WZ32.DLL. It contains the following functions (among others):
- zip_init() / zip()
- unzip_init() / unzip()
- uncompress_init() / uncompress()
- check_multi_volume()
- find_split_parts()

I have been looking for a site that contains information on how to call these functions, but I can't seem to find them. According to someone vbAccelerator.com should have an example using the DLLs of Winzip instead of the commandline tool, but I can't seem to get to vbAccelerator to check it (has the site ceased to exist?). I know that it would be a VB example, but that could easily be translated, right?

ATOH, the link to undu.com contains a fully working example with source code. You just have to cut 'n' paste it and you can use it with Winzip. It may be not so neat as using the dlls, but it saves a lot of time figuring out the parameters of them.

Regards,
Abel
0
 

Author Comment

by:krydea
ID: 7243371
can you plz give an example??
0
 
LVL 22

Accepted Solution

by:
mnasman earned 200 total points
ID: 7245845
when I post the links all them was working fine

I gave you alot of examples, and sent to your email also

but seems you don't want to close this question
0
 
LVL 39

Expert Comment

by:abel
ID: 7246135
Some links in VB, which should be easy to translate to Delphi. I couldn't get to vbaccelerator earlier, but here it is:
http://vbaccelerator.com/codelib/zip/zipvb.htm
And a previous discussion about it at EE (again it's VB): http:Q.11156169.html

But perhaps you didn't read the comments of people. So, once more: the UNDO.COM link from mnasman provides a fully working example. And that's what you mean with an example, right? Try to use it. If you can't get it to work, tell us what't wrong and we'll help you further. Or close the question and give mnasman his/her credits.

Regards,
Abel
0
 
LVL 21

Expert Comment

by:gemarti
ID: 7247478
This post is over a year old. I sure wish I hadn't posted a comment. I keep getting emails for this post and I don't see any benefit of this post still being in the queue.
0
 
LVL 21

Expert Comment

by:gemarti
ID: 7247480
BTW I'm unsubscribing.
0
 

Author Comment

by:krydea
ID: 7248855
your right thanx mate
0
 
LVL 22

Expert Comment

by:mnasman
ID: 7253004
wooow, after a year this question closed
thanks alot krydea  :)
0
 

Author Comment

by:krydea
ID: 7254508
LoL..
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now