terça-feira, 22 de setembro de 2009

Visualizando arquivos compactados cab

Procedure TFormPrincipal.BotaoAbrirClick (Sender: TObject);
var
K : Integer;
N : Integer;
Info: pInfoCabinet;
Nome: String;
Path: String;
begin
SetCurrentDir ('D:TempCab');
if OpenDialog.Execute then begin
N := 0;
Cabinet:= TCabinet.Create;
Cabinet.LoadFromFile (OpenDialog.FileName);
Lista.Items.BeginUpdate;
Lista.Items.Clear;
Lista.ViewStyle:= vsReport;
for K:= 0 to Cabinet.Lista.Count-1 do begin
Nome:= Cabinet.ExtrairNomePath (Cabinet.Lista.Strings[K], Path);
if Nome <> '' then
with Lista.Items.Add do begin
Inc (N);
Caption:= Nome;
Info := pInfoCabinet (Cabinet.Lista.Objects[K]);
if Info <> nil then
with Info^ do begin
SubItems.Add (IntToStr (Descompactado));
SubItems.Add (DateTimeToStr (Modificado));
SubItems.Add (Path);
end;
end;
end;
Lista.Items.EndUpdate;
Caption:= OpenDialog.FileName + ' - ' + IntToStr (N) + ' arquivo(s)';
Cabinet.Free;
end;
end;

Nenhum comentário:

Postar um comentário