unit Rar;
interfaceuses SysUtils,ShellAPI,Windows,Forms;
const IM_RAR_EXE ='Rar.dll'; IM_UNRAR_TIME = 1000; IM_RAR_FILENAME ='aa.rar';type TimRar = class(TObject) private
public constructor Create ; function CheckRar : boolean ; procedure UnRar(aFileName:string) ; procedure DoRar(aFileName:string) ; procedure DoUpdateUnRar ;
end ;
implementationuses Obj;{ TIMRar }
function TIMRar.CheckRar: boolean;begin if not FileExists(ExtractFilePath(Application.ExeName)+IM_RAR_EXE) then begin TimObj.Msg('找不到Rar组件,压缩无法进行','',6); Result := False; Exit ; end; Result := True ;end;
constructor TIMRar.Create;beginend;
procedure TIMRar.DoRar(aFileName:string);var vCmd : string ;begin vCmd := IM_RAR_EXE + ' a '+ aFileName ; WinExec(pChar(vCmd),0);end;
procedure TIMRar.DoUpdateUnRar;var vCmd : string ;begin vCmd := IM_RAR_EXE + ' e '+ IM_RAR_FILENAME + ' -o+' ; WinExec(pChar(vCmd),0);end;
procedure TIMRar.UnRar(aFileName:string);var vCmd : string;begin vCmd := IM_RAR_EXE + ' e '+ aFileName + ' -o+' ; WinExec(pChar(vCmd),0);end;
end.
