16,743
社区成员




(*
This demo was updated to support unicode and the TNT unicode controls.
See ..\unicode_notes.txt for usage notes on the TNT_UNICODE
conditional define (the file is in [ziptv install dir]\demos).
*)
Unit Unit1;
Interface
Uses
Windows,
Messages,
SysUtils,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls,
ztvRegister,
ztvBase,
ztvConsts, // _String unicode
ztvUnRar,
ztvGbls;
Type
TForm1 = Class(TForm)
Button1: TButton;
UnRAR1: TUnRAR;
CheckBox1: TCheckBox;
Button2: TButton;
Procedure Button1Click(Sender: TObject);
{$ifdef TNT_UNICODE}
Procedure UnRar1GetPassword(Sender: TObject; FileName: WideString;
Var Password: String; Var HeaderKeys, DataKeys: TSeedKeyRecord;
Var TryAgain: Boolean);
{$else}
Procedure UnRar1GetPassword(Sender: TObject; FileName: String;
Var Password: String; Var HeaderKeys, DataKeys: TSeedKeyRecord;
Var TryAgain: Boolean);
procedure Button2Click(Sender: TObject);
{$endif TNT_UNICODE}
Private
{ Private declarations }
Public
{ Public declarations }
End;
Var
Form1: TForm1;
Implementation
{$R *.DFM}
//-------------------------------------------------------------
Procedure TForm1.Button1Click(Sender: TObject);
Begin
UnRAR1.ArchiveFile := 'd:\3\rar\exes.rar';
UnRAR1.ExtractDir := 'c:\hold1\';
UnRAR1.UseStoredDirs := CheckBox1.Checked;
UnRAR1.DateAttribute := daFileDate;
UnRAR1.ConfirmOverwrites := False;
UnRAR1.OverwriteMode := omOverwrite;
UnRAR1.RestoreFileAttr := False;
UnRAR1.CreateStoredDirs := False;
UnRAR1.TranslateOemChar := True;
UnRAR1.RecurseDirs := True;
UnRAR1.VolumeName := '';
UnRAR1.FileSpec.Clear();
//unRar1.FileSpec.Add('SRC\ATL.CPP');
UnRAR1.FileSpec.Add('*.*');
UnRAR1.RecurseDirs := True;
UnRAR1.Extract();
ShowMessage(IntToStr(UnRAR1.Count));
End;
//-------------------------------------------------------------
Procedure TForm1.UnRar1GetPassword(Sender: TObject; FileName: _String;
Var Password: String; Var HeaderKeys, DataKeys: TSeedKeyRecord;
Var TryAgain: Boolean);
Begin
//Password := '-0-OSPREY-0-RAID-0-';
End;
//-------------------------------------------------------------
procedure TForm1.Button2Click(Sender: TObject);
begin
UnRar1.Cancel := True;
end;
End.