ne letzte frage hätt ich aber noch...
Also ich hab alles eingebunden und packe Dateien mit folgendem Code:
Quelltext
1: 2: 3:
| Zipmaster1.ZipFilename:='datei.zip'; Zipmaster1.FSpecArgs.Add('test.exe'); Zipmaster1.Add; |
Funktioniert auch prima, da aber manchmal ziemlich große Files dem Archiv hinzugefügt werden, hätte ich den jeweiligen Status gerne in einer Progressbar. In der Zipmaster Hilfe habe ich dazu das gefunden:
Zitat: |
Type
TOnItemProgressEvent = procedure(Sender: TObject; Item: string;
TotalSize:cardinal; PerCent: integer) of object;
Property OnItemProgress: TOnItemProgressEvent ;
Description
Use it to show progress for each item on a ProgressBar or similar indicator.
The 'End of Batch' condition is marked by PerCent = -1
Example
procedure TForm1.ZipMaster1ItemProgress(Sender: TObject; Item: string;
TotalSize:cardinal; PerCent: integer);
begin
if PerCent = 0 then // reduces flashing
Label1.Caption := Item;
ProgressBar1.Position := PerCent;
end;
|
Also habe ich mal oben bei Type folgendes hinzugefügt:
Quelltext
1: 2:
| procedure ZipMaster1ItemProgress(Sender: TObject; Item: string; TotalSize:cardinal; PerCent: integer); |
und unter implementation das:
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9:
| procedure TForm1.ZipMaster1ItemProgress(Sender: TObject; Item: string; TotalSize:cardinal; PerCent: integer);
begin if PerCent = 0 then // reduces flashing Label1.Caption := Item; ProgressBar1.Position := PerCent;
end; |
Das lässt er so auch compilieren, nur tut sich natürlich nichts wenn ich eine File hinzufüge...Wie weise ich dem jetzt diese prozedur zu, dass er beim hinzufügen die Progressbar1 füllt?
mfg
Nor
//edit: Das habe ich auch noch dazu gefunden:
Zitat: |
OnProgress event occurs during compression and decompression of a Zip archive and while disk (un)spanning.
Type TProgressEvent = Procedure( Sender: TObject; ProgrType: ProgressType; Filename: String; FileSize: cardinal ) of object;
property OnProgress: TProgressEvent;
Description:
Intended for "status bar" or "progress bar" updates. Criteria for this event:
ProgressType is defined as one of the types below:
TotalSize2Process
At the start of processing a (batch of) file(s) with the Add, Extract or Test method this gives the total uncompressed file size which will be processed by the given method. This can be used to show a progress bar for the entire job. This size is also available in the TotalSizeToProcess property. Changed 1.72 - If Filename is not empty it contains the operation name (Clearing Archive Bit etc)
TotalFiles2Process
At the start of processing a (batch of) file(s) with the Add, Extract or Test method you will get the total number of files which will be processed by the given method.
NewFile
Starting to process a new file. (gives you the filename and total uncompressed filesize for the given file.)
ProgressUpdate
Every xxxK bytes while processing a file. The actual progress 'xxx' is given in FileSize.
For Zip compression this will be 64K, n times 32K, and the remaining file bytes.
For Unzip uncompression this will be: n times 32K and the remaining file bytes.
For Zip (un)spanning actions it will be 8K.
EndOfBatch Completed processing on a (batch of) file(s).
|