有沒有辦法從zip壓縮一個文件? 我使用基於response爲 How to get Inno Setup to unzip a file it installed (all as part of the one installation process)代碼,可以完美的解壓,但沒有一個知道這是怎麼可以解壓縮單個文件:如何讓Inno Setup解壓縮單個文件?
[Code]:
const
NO_PROGRESS_BOX = 4;
RESPOND_YES_TO_ALL = 16;
procedure UnZip(ZipPath, TargetPath: string);
var
Shell: Variant;
ZipFile: Variant;
TargetFolder: Variant;
begin
Shell := CreateOleObject('Shell.Application');
ZipFile := Shell.NameSpace(ZipPath);
if VarIsClear(ZipFile) then
RaiseException(Format('ZIP file "%s" does not exist or cannot be opened', [ZipPath]));
TargetFolder := Shell.NameSpace(TargetPath);
if VarIsClear(TargetFolder) then
RaiseException(Format('Target path "%s" does not exist', [TargetPath]));
TargetFolder.CopyHere(ZipFile.Items, NO_PROGRESS_BOX or RESPOND_YES_TO_ALL);
end;
謝謝,作品完美。 –