Delphi 2007 で JEDI JCL を使用していくつかのファイルを圧縮しようとしています。問題は、このエラーが何度も発生する理由が分からないことです " Sevenzip: Failed to load 7z.dll
"
私のコードは次のとおりです。
var
archiveclass: TJclDecompressArchiveClass;
archive: TJclDecompressArchive;
item: TJclCompressionItem;
s: String;
i: Integer;
begin
archiveclass := GetArchiveFormats.FindDecompressFormat(dir);
if not Assigned(archiveclass) then
raise Exception.Create('Could not determine the Format of ' + dir);
archive := archiveclass.Create(dir);
try
if not (archive is TJclSevenZipDecompressArchive) then
raise Exception.Create('This format is not handled by 7z.dll');
archive.ListFiles;
s := Format('test.zip Item Count: %d'#13#10#13#10, [archive.ItemCount]);
for i := 0 to archive.ItemCount - 1 do
begin
item := archive.Items[i];
case item.Kind of
ikFile:
s := s + IntToStr(i+1) + ': ' + item.PackedName + #13#10;
ikDirectory:
s := s + IntToStr(i+1) + ': ' + item.PackedName + '\'#13#10;//'
end;
end;
if archive.ItemCount > 0 then
begin
// archive.Items[0].Selected := true;
// archive.ExtractSelected('F:\temp\test');
archive.ExtractAll('F:\temp\test');
end;
ShowMessage(s);
finally
archive.Free;
end;
Delphi プロジェクトと同じフォルダに 7z.dll があります。私は何を間違っていますか?また、フォルダを7zする簡単な方法は他にありますか? フォルダーから zip を作成するためだけに、複雑なタスクを探しているわけではありません。