Erik N
asked on
Creating compressed file form app?
I want to create(compress several files) a Zip-file or some other from my app. Is it possible, how do I do it?
I use Delphi Developer 2.0...
Thanx!
Erik N
I use Delphi Developer 2.0...
Thanx!
Erik N
Check for a compressing component on the DSP. There are some freeware ones available.
You need to zip the file with pkzip?
Hi Erik,
use this function:
uses ...., ShellAPI; //IMPORTANT
procedure PKZIP(Files, DestFile, WorkDir:string);
var aux : integer;
Command, Params: string;
begin
{ convert Pascal string to Null-termintated strings }
Command := 'PKZIP.EXE' + #0;
Params := DestFile + ' ' + Files + #0; //Set aditional parameters here
WorkDir := WorkDir + #0;
{ run/ application/file }
aux := ShellExecute(Application.M ainForm.Ha ndle,'Open ',@Command [1],@Param s[1],@Work Dir[1], 0);
if aux < 32 Then
MessageDlg('Could not execute'+Command,mtError,[ mbOK],0);
end;
Example:
procedure TForm1.Button1Click(Sender : TObject);
begin
PKZIP('*.sys', 'test', 'c:\');
end;
IHTH,
Itamar
P.S.: Any doubts, place a comment before rejecting the answer.
use this function:
uses ...., ShellAPI; //IMPORTANT
procedure PKZIP(Files, DestFile, WorkDir:string);
var aux : integer;
Command, Params: string;
begin
{ convert Pascal string to Null-termintated strings }
Command := 'PKZIP.EXE' + #0;
Params := DestFile + ' ' + Files + #0; //Set aditional parameters here
WorkDir := WorkDir + #0;
{ run/ application/file }
aux := ShellExecute(Application.M
if aux < 32 Then
MessageDlg('Could not execute'+Command,mtError,[
end;
Example:
procedure TForm1.Button1Click(Sender
begin
PKZIP('*.sys', 'test', 'c:\');
end;
IHTH,
Itamar
P.S.: Any doubts, place a comment before rejecting the answer.
ASKER
Dear Itamar.
This worked just fine, however I want to compress the files without being dependent on some external program, like Pkzip.exe. Is this possible ?
Thank you Itamar, for your time...
/Erik N
This worked just fine, however I want to compress the files without being dependent on some external program, like Pkzip.exe. Is this possible ?
Thank you Itamar, for your time...
/Erik N
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you itamar !
Sorry, I wanted the ZIP-format or some other, but I didn't want to use the external call (my mistake).
/Erik N
Sorry, I wanted the ZIP-format or some other, but I didn't want to use the external call (my mistake).
/Erik N
ASKER