Yorumları: 164
Konuları: 32
Kayıt Tarihi: 08-05-2017
Rep Puanı: 434
Acemi
Teşekkürler
problem kaynağı : pansichar
Yorumları: 157
Konuları: 15
Kayıt Tarihi: 16-01-2021
Aktif Kullandığınız Delphi Sürümü:
Rep Puanı: 813
Acemi
16-01-2024, Saat: 11:19
(Son Düzenleme: 18-01-2024, Saat: 14:03, Düzenleyen: COMMANDX.)
Bu da benden olsun, ZipForge ComponentAce komponentinin çok sade örnekleri
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ZipForge, ComCtrls;
type
TForm1 = class(TForm)
Archiver: TZipForge;
Button1: TButton;
Button2: TButton;
ProgressBar1: TProgressBar;
lblFile: TLabel;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ZipForge1FileProgress(Sender: TObject; FileName: WideString;
Progress: Double; Operation: TZFProcessOperation;
ProgressPhase: TZFProgressPhase; var Cancel: Boolean);
procedure ZipForge1OverallProgress(Sender: TObject; Progress: Double;
Operation: TZFProcessOperation; ProgressPhase: TZFProgressPhase;
var Cancel: Boolean);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//- BURASI LABELİ VE PROGRESSBARI İŞLİYOR------
procedure TForm1.ZipForge1FileProgress(Sender: TObject;
FileName: WideString; Progress: Double; Operation: TZFProcessOperation;
ProgressPhase: TZFProgressPhase; var Cancel: Boolean);
begin
lblFile.Caption := 'Extracting: ' + FileName;
Application.ProcessMessages;
end;
procedure TForm1.ZipForge1OverallProgress(Sender: TObject;
Progress: Double; Operation: TZFProcessOperation;
ProgressPhase: TZFProgressPhase; var Cancel: Boolean);
begin
ProgressBAR1.Position := Trunc(Progress);
Application.ProcessMessages;
end;
//-----------------------
//---------------- Only a File Zip Compress ------------
procedure TForm1.Button1Click(Sender: TObject);
begin
try
with archiver do
begin
Password:='1212';
// Set the name of the archive file we want to create
FileName := 'C:\test_FILE.zip';
// Because we create a new archive,
// we set Mode to fmCreate
OpenArchive(fmCreate);
// Set base (default) directory for all archive operations
BaseDir := 'C:\';
// Add file C:\test.txt the archive; wildcards can be used as well
AddFiles('c:\A.XLS');
CloseArchive();
end;
except
on E: Exception do
begin
Writeln('Exception: ', E.Message);
// Wait for the key to be pressed
Readln;
end;
end;
end;
//----------- Folders Zip Compress--------
procedure TForm1.Button2Click(Sender: TObject);
begin
try
with archiver do
begin
Password:='1212';
// Set the name of the archive file we want to create
FileName := 'C:\test_FOLDERS.zip';
// Because we create a new archive,
// we set Mode to fmCreate
OpenArchive(fmCreate);
// Set base (default) directory for all archive operations
BaseDir := 'C:\';
// Add the c:\Test folder to the archive with all subfolders
AddFiles('C:\PUANTAJ\*.*'); // PUANTAJ KLASÖRÜNÜ ZİPLE
CloseArchive();
end;
except
on E: Exception do
begin
Writeln('Exception: ', E.Message);
// Wait for the key to be pressed
Readln;
end;
END;
END;
//------- File Unzip Extract ----------------------
procedure TForm1.Button3Click(Sender: TObject);
begin
try
with archiver do
begin
PASSWORD:='1212';
// The name of the ZIP file to unzip
FileName := 'C:\test_FILE.zip';
// Open an existing archive
OpenArchive(fmOpenRead);
// Set base (default) directory for all archive operations
BaseDir := 'C:\';
// Extract all files from the archive to C:\ folder
ExtractFiles('*.*');
CloseArchive();
end;
except
on E: Exception do
begin
Writeln('Exception: ', E.Message);
// Wait for the key to be pressed
Readln;
end;
end;
end;
//-----------klasörleri unzip extract ---------------
procedure TForm1.Button4Click(Sender: TObject);
begin
try
with archiver do
begin
PASSWORD:='1212';
// The name of the ZIP file to unzip
FileName := 'C:\test_FOLDERS.zip';
// Open an existing archive
OpenArchive(fmOpenRead);
// Set base (default) directory for all archive operations
BaseDir := 'C:\';
// Extract all files from the archive to C:\ folder
ExtractFiles('*.*');
CloseArchive();
end;
except
on E: Exception do
begin
Writeln('Exception: ', E.Message);
// Wait for the key to be pressed
Readln;
end;
end;
end;
END.
__________________________
From Now I will only Reading.