Solved

compresing

Posted on 2002-07-15
7
152 Views
Last Modified: 2010-04-04
how to use the functionality of windows wich enables to compress and uncompress the data? i mean the packages *.CAB, wich are used in win installations.

i need to compress any file to optimize it;s movement thru the net. there is no need to protect the data by coding them.
0
Comment
Question by:pistacer
[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
  • 3
  • 3
7 Comments
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7154203
you can use TCabFile from TMS software or Delphi Zip components from http://www.geocities.com/SiliconValley/Network/2114/index.html
0
 

Author Comment

by:pistacer
ID: 7154232
well, i hoped for the "native way" - i mean i do not want to use any zips, rars or something else and i want not to buy something (if it is possible). i would like to build my own unit/component to provide this.

does anybody know the sources of descriptions for this problem? any literatury, when the components are not awailable.
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7154426
well you can do all the work yourself if you want to
just download the CAB SDK from here :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncabsdk/html/cabdl.asp

I'll try to find a free delphi cab wrapper
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Accepted Solution

by:
Lee_Nover earned 150 total points
ID: 7154466
and here are some compos found on the net :)
you'll probably like this one : http://www.mischel.com/pubs/grab_a_cab.htm
http://www.delphi32.com/vcl/lists/sc_n_67.asp
and ofcourse torrys : http://www.torry.net/compressstd.htm
should keep you busy for a while :)
0
 
LVL 1

Expert Comment

by:mgazza
ID: 7154702
dont know how 2 use *.cab but i do know how 2 compress files + add them together like winzip heres the comopression part you will need to declare zlib in the USES part!

procedure CompressStream(inpStream, outStream: TStream);
var
 InpBuf,OutBuf: Pointer;
 InpBytes,OutBytes: integer;
begin
 InpBuf := nil;
 OutBuf := nil;
 try
   GetMem(InpBuf,inpStream.size);
   inpStream.Position := 0;
   InpBytes := inpStream.Read(InpBuf^,inpStream.size);
   CompressBuf(InpBuf,InpBytes,OutBuf,OutBytes);
   outStream.Write(OutBuf^,OutBytes);
 finally
   if InpBuf <> nil then FreeMem(InpBuf);
   if OutBuf <> nil then FreeMem(OutBuf);
 end;
end;
procedure DecompressStream(inpStream, outStream: TStream);
var
 InpBuf,OutBuf: Pointer;
 OutBytes,sz: integer;
begin
 InpBuf := nil;
 OutBuf := nil;
 sz := inpStream.size-inpStream.Position;
 if sz > 0 then try
   GetMem(InpBuf,sz);
   inpStream.Read(InpBuf^,sz);
   DecompressBuf(InpBuf,sz,0,OutBuf,OutBytes);
   outStream.Write(OutBuf^,OutBytes);
 finally
   if InpBuf <> nil then FreeMem(InpBuf);
   if OutBuf <> nil then FreeMem(OutBuf);
 end;
 outStream.Position := 0;
end;
0
 

Author Comment

by:pistacer
ID: 7156381
well, the cab sdk is the best solution of my needs, so i will accept Lee_Nover's answers.

but i thank for all yours interresting comments!
0
 

Author Comment

by:pistacer
ID: 7156382
thanks Lee_Nover!
0

Featured Post

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!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month4 days, 1 hour left to enroll

630 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