unit Unit1;
interface
uses
ComObj, ActiveX, AspTlb, Project1_TLB, StdVcl,VCLUnZip,VclZip;
type
TComZip = class(TASPObject, IComZip)
protected
procedure OnEndPage
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown)
safecall;
procedure Unzip(const FileName: WideString)
safecall;
procedure zip(const FileName: WideString)
safecall;
end;
implementation
uses ComServ;
procedure TComZip.OnEndPage;
begin
inherited OnEndPage;
end;
procedure TComZip.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
procedure TComZip.Unzip(const FileName: WideString);
var
UnZip:TVclUnZip;
begin
UnZip:=TvclUnZip.Create(Nil);
Try
Unzip.zipName:=FileName;
UnZip.DoAll:=true;
UnZip.UnZip;
finally
Unzip.free;
end;
end;
procedure TComZip.zip(const FileName: WideString);
var
Zip:TVclZip;
begin
Zip:=TvclZip.Create(Nil);
Try
Zip.zipName:='Zip.Zip';
Zip.FilesList.Add(FileName);
Zip.Zip;
finally
Zip.free;
end;
end;
initialization
TAutoObjectFactory.Create(ComServer, TComZip, Class_ComZip,
ciMultiInstance, tmApartment);
end.