1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
procedure TForm1.btnUpdateClick(Sender: TObject);
begin
lbFiles.Clear;
CabDecompressor1.Extract(edFilename.Text, nil);
end;
function TForm1.CabDecompressor1CopyFile(AFilename: PChar;
Size: Integer; date, time, attribs, iFolder: Word;
pUserData: Pointer): Integer;
var
TempHandle : Integer;
ExtractFilename : PString absolute pUserData;
begin
// If extracting a file, then compare this filename with the
// file that we want to extract. If they match, then open
// the file and return the handle. Otherwise just return 0.
if FExtracting then
begin
if CompareText (AFilename, ExtractFilename^) = 0 then
begin
// open a file for writing and return the handle.
TempHandle := CabDecompressor1.Callbacks.OpenFunc
(AFilename,
(O_BINARY or O_CREAT or O_TRUNC or O_WRONLY or
O_SEQUENTIAL),
(S_IREAD or S_IWRITE));
Result := TempHandle;
end
else
Result := 0;
end
else begin
lbFiles.Items.Add (AFilename);
Result := 0;
end;
end;
function TForm1.CabDecompressor1CloseFile(AFilename: PChar;
hf: Integer; date, time, attribs, iFolder: Word;
RunFile: Integer; pUserData: Pointer): Integer;
begin
// Done writing file.
// Close it and set the date and attributes.
cabd.CloseAndDateStampFile
(AFilename, hf, date, time, attribs);
Result := 1;
end;
procedure TForm1.btnExtractClick(Sender: TObject);
var
Filename : String;
begin
if lbFiles.ItemIndex <> -1 then
begin
// Get filename and set extracting flag.
Filename := lbFiles.Items[lbFiles.ItemIndex];
FExtracting := true;
// do the extract
CabDecompressor1.Extract (edFilename.Text, @Filename);
FExtracting := false;
end;
end;
procedure TForm1.lbFilesClick(Sender: TObject);
begin
//flash.Movie := filename; //Ici rien ne fonctionne
flash.playing := true;
end; |
Partager