Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

big problem

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
krydea
Asked:
krydea
  • 25
  • 18
  • 4
  • +4
1 Solution
 
Mohammed NasmanSoftware DeveloperCommented:
0
 
gemartiCommented:
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
 
krydeaAuthor Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Mohammed NasmanSoftware DeveloperCommented:
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
 
gemartiCommented:
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
 
krydeaAuthor Commented:
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
 
krydeaAuthor Commented:
can you plz do that?
0
 
krydeaAuthor Commented:
mnasman : do i need those dll on the comuter were i use the powerarc stuff?
0
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
jswebyCommented:
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
 
krydeaAuthor Commented:
mnasman : can you plz give me links so i can donload stuff i dont understand this i'm only 14:p
0
 
krydeaAuthor Commented:
krydea@hotmail.com
0
 
Mohammed NasmanSoftware DeveloperCommented:
I sent u email with the project
0
 
krydeaAuthor Commented:
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
 
YevgenCommented:
Here's something to overload you brain:

www.datacompression.com
0
 
YevgenCommented:
Oh, sorry that is a stupid site...

This is the one: www.data-compression.com
0
 
krydeaAuthor Commented:
are the points to low to give me some download links?;)
umm..wait i will look on www.delphipages.com
0
 
krydeaAuthor Commented:
there is notthing..
0
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
krydeaAuthor Commented:
i'm 15 years old do you realy thing i can get that kind of monney?
0
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
krydeaAuthor Commented:
thanx. i will donloading the c sourcecode.
0
 
krydeaAuthor Commented:
umm sorry but i can find the source code's.... can you maybe mail them to..?
0
 
Mohammed NasmanSoftware DeveloperCommented:
krydea
I sent you the source code from few days
have u got it?
0
 
krydeaAuthor Commented:
yes but i still can get it to work..:(
did you ever looked on www.planetsourcecode.com?
0
 
krydeaAuthor Commented:
i still can't fint a **** that work's good....
0
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
krydeaAuthor Commented:
k,
do you have then a fast and good working compresing with dlls?
0
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
krydeaAuthor Commented:
doesn't winzip geve anny dll's?
0
 
Mohammed NasmanSoftware DeveloperCommented:
Look in winzip directory, and you will find 7 dlls
0
 
krydeaAuthor Commented:
can you give me the link?
or do you mean on my computer?
0
 
Mohammed NasmanSoftware DeveloperCommented:
in your computer
look in the winzip folder and u will find the dll's in it, in ..\Program Files\winzip
0
 
krydeaAuthor Commented:
k,
i'm gana look but how do i know what the function's are i have to call?
0
 
krydeaAuthor Commented:
i found:
WZSHLSTB.DLL        
WZSHLEX1.DLL        
WZCAB3.DLL        
WZVINFO.DLL        
WZZPMAIL.DLL      
WZ32.DLL      
WZCAB.DLL      
0
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
krydeaAuthor Commented:
i know.. but what are the dll functions:s...
0
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
krydeaAuthor Commented:
so you can explane?
0
 
Mohammed NasmanSoftware DeveloperCommented:
read the links :o)
0
 
amp072397Commented:
krydea:

Just a friendly reminder to return to this open question.

thanks!
amp
community support moderator
0
 
krydeaAuthor Commented:
:s
k sorry i forgot about it.. and those links doesn't work:S
0
 
Mohammed NasmanSoftware DeveloperCommented:
most of the links i gave to you working fine :)
0
 
abelCommented:
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
 
krydeaAuthor Commented:
can you plz give an example??
0
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
abelCommented:
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
 
gemartiCommented:
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
 
gemartiCommented:
BTW I'm unsubscribing.
0
 
krydeaAuthor Commented:
your right thanx mate
0
 
Mohammed NasmanSoftware DeveloperCommented:
wooow, after a year this question closed
thanks alot krydea  :)
0
 
krydeaAuthor Commented:
LoL..
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

  • 25
  • 18
  • 4
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now