IM13
26-10-2004, 16:38
моя программа используется для групового архивирования и разар. файлов в разных дирректориях процедура архивации и разар. я взял из примера
Var
* FilesCompressed: Integer;
Begin
* Cursor := crHourGlass;
* ListBox1.Clear();
* If FileExists(Edit1.Text) Then
* * *If MessageDlg(
* * * * 'Archive exists... overwrite?',
* * * * mtConfirmation,
* * * * [mbYes, mbNo],
* * * * 0) = mrYes Then
* * * * // move to recycle bin
* * * * EraseFile(Edit1.Text, doAllowUndo) // EraseFile is in ztvBase.pas
* * *Else
* * * * Exit;
* Zip1.ArchiveFile := Edit1.Text; * * *// archive filename
* Zip1.DateAttribute := daFileDate; * *// default value
* Zip1.StoredDirNames := sdRelative; * // default value
* Zip1.CompressMethod := cmDeflate; * *// default value
* Zip1.RecurseDirs := CheckBox2.Checked; // default = False
* Zip1.Switch := swAdd; * * * * * * * *// default value
* Zip1.StoreEmptySubDirs := False; * * // default value
* Zip1.EncryptHeaders := CheckBox1.Checked; // default = False
* Zip1.ExcludeSpec.Clear();
* Zip1.FileSpec.Clear();
* Zip1.FileSpec.Add(Edit2.Text); * * * // test with c:\windows\*.txt
* // ****************************************************************
* // NOTE: for a better understanding of how the Attributes property
* // works with file attributes see demo demos\filescan\fs_demo.dpr.
* // ****************************************************************
* // See the Attributes property in the object inspector
* // Set Zip1 Attributes property by calling the SetAttribute method
* Zip1.SetAttribute(fsZeroAttr, True); // default
* Zip1.SetAttribute(fsArchive, True); *// default
* Zip1.SetAttribute(fsDirectory, True); // default = False
* Zip1.SetAttribute(fsHidden, True); * // default = False
* Zip1.SetAttribute(fsReadOnly, True); // default
* Zip1.SetAttribute(fsSysFile, True); *// default = False
* // See the AttributesEx property in teh object inspector
* // Set the AttributesEx property by calling the SetAttributeEx method.
* // Exclude none
* Zip1.SetAttributeEx(fsZeroAttr, False); // default
* Zip1.SetAttributeEx(fsArchive, False); // default
* Zip1.SetAttributeEx(fsDirectory, False); // default
* Zip1.SetAttributeEx(fsHidden, False); // default
* Zip1.SetAttributeEx(fsReadOnly, False); // default
* Zip1.SetAttributeEx(fsSysFile, False); // default
* FilesCompressed := Zip1.Compress();
* ShowMessage('Files Compressed: ' + IntToStr(FilesCompressed));
* Cursor := crDefault;
End;
на строке FilesCompressed := Zip1.Compress(); процесс автоматически переходит на
Procedure TForm1.Zip1Begin(Sender: TObject; FName: String; Count: Integer;
* Var Extract: Boolean);
Begin
* ListBox1.Items.Add(FName);
* StatusBar1.SimpleText := FName;
End;
и выводит в listbox все файлы которые она сжимает, я сделал пости точную копию и вставил в свою прогу но у меня такого перехода не происходит - прога просто производит действия сжатия. Кто нибудь пояснит мне в чем проблема ?
Исправлено: Prisoner, 2:27 27-10-2004
Var
* FilesCompressed: Integer;
Begin
* Cursor := crHourGlass;
* ListBox1.Clear();
* If FileExists(Edit1.Text) Then
* * *If MessageDlg(
* * * * 'Archive exists... overwrite?',
* * * * mtConfirmation,
* * * * [mbYes, mbNo],
* * * * 0) = mrYes Then
* * * * // move to recycle bin
* * * * EraseFile(Edit1.Text, doAllowUndo) // EraseFile is in ztvBase.pas
* * *Else
* * * * Exit;
* Zip1.ArchiveFile := Edit1.Text; * * *// archive filename
* Zip1.DateAttribute := daFileDate; * *// default value
* Zip1.StoredDirNames := sdRelative; * // default value
* Zip1.CompressMethod := cmDeflate; * *// default value
* Zip1.RecurseDirs := CheckBox2.Checked; // default = False
* Zip1.Switch := swAdd; * * * * * * * *// default value
* Zip1.StoreEmptySubDirs := False; * * // default value
* Zip1.EncryptHeaders := CheckBox1.Checked; // default = False
* Zip1.ExcludeSpec.Clear();
* Zip1.FileSpec.Clear();
* Zip1.FileSpec.Add(Edit2.Text); * * * // test with c:\windows\*.txt
* // ****************************************************************
* // NOTE: for a better understanding of how the Attributes property
* // works with file attributes see demo demos\filescan\fs_demo.dpr.
* // ****************************************************************
* // See the Attributes property in the object inspector
* // Set Zip1 Attributes property by calling the SetAttribute method
* Zip1.SetAttribute(fsZeroAttr, True); // default
* Zip1.SetAttribute(fsArchive, True); *// default
* Zip1.SetAttribute(fsDirectory, True); // default = False
* Zip1.SetAttribute(fsHidden, True); * // default = False
* Zip1.SetAttribute(fsReadOnly, True); // default
* Zip1.SetAttribute(fsSysFile, True); *// default = False
* // See the AttributesEx property in teh object inspector
* // Set the AttributesEx property by calling the SetAttributeEx method.
* // Exclude none
* Zip1.SetAttributeEx(fsZeroAttr, False); // default
* Zip1.SetAttributeEx(fsArchive, False); // default
* Zip1.SetAttributeEx(fsDirectory, False); // default
* Zip1.SetAttributeEx(fsHidden, False); // default
* Zip1.SetAttributeEx(fsReadOnly, False); // default
* Zip1.SetAttributeEx(fsSysFile, False); // default
* FilesCompressed := Zip1.Compress();
* ShowMessage('Files Compressed: ' + IntToStr(FilesCompressed));
* Cursor := crDefault;
End;
на строке FilesCompressed := Zip1.Compress(); процесс автоматически переходит на
Procedure TForm1.Zip1Begin(Sender: TObject; FName: String; Count: Integer;
* Var Extract: Boolean);
Begin
* ListBox1.Items.Add(FName);
* StatusBar1.SimpleText := FName;
End;
и выводит в listbox все файлы которые она сжимает, я сделал пости точную копию и вставил в свою прогу но у меня такого перехода не происходит - прога просто производит действия сжатия. Кто нибудь пояснит мне в чем проблема ?
Исправлено: Prisoner, 2:27 27-10-2004