Genri
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Код: [Setup] AppName=My Program AppVerName=My Program [Version] DefaultDirName={pf}\My Program [Files] Source: Files\*; DestDir: {app} Source: Image.bmp; DestDir: {app} [Code] var Form: TSetupForm; ExtraFilesList: TMemo; CancelButton, DelButton: TButton; UpImage, DownImage, Image: TBitmapImage; UpPanel, DownPanel: TPanel; NameLabel, DescriptionLabel, BeforeListBoxLabel: TLabel; DownTextLabel: TLabel; function InitializeUninstall(): Boolean; begin FileCopy(ExpandConstant('{app}\Image.bmp'), ExpandConstant('{tmp}\Image.bmp'), True); Result := True; end; procedure FillListBox(const fromDir, fileMask: string; Level: Byte); var FSR, DSR: TFindRec; FindResult: Boolean; APath: String; MainLen: Integer; i: Integer; begin MainLen:= Length(ExpandConstant('{app}')); APath := AddBackslash(fromDir); FindResult := FindFirst(APath + fileMask, FSR); try while FindResult do begin if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then begin {files} i:= ExtraFilesList.Lines.Add(Copy(APath + FSR.Name, MainLen+2, Length(APath + FSR.Name))); end; FindResult := FindNext(FSR); end; FindResult := FindFirst(APath + '*.*', DSR); while FindResult do begin if ((DSR.Attributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY) and not ((DSR.Name = '.') or (DSR.Name = '..')) then begin {Recursion} FillListBox(APath + DSR.Name, fileMask, Level+1); end; FindResult := FindNext(DSR); end; finally FindClose(FSR); FindClose(DSR); end; end; procedure DeleteFiles(); begin DelTree(ExpandConstant('{app}'), True, True, True); end; procedure BrowseRemainedFiles(); begin Form := CreateCustomForm; Form.ClientWidth := ScaleX(504); Form.ClientHeight := ScaleY(358); Form.Caption := 'Paradise - InstallShield Wizard'; Form.Center; UpImage := TBitmapImage.Create(Form); UpImage.Top := ScaleY(0); UpImage.Left := ScaleX(0); UpImage.Width := Form.ClientWidth; UpImage.Height := ScaleY(59); UpImage.BackColor := clWhite; UpImage.Parent := Form; Image := TBitmapImage.Create(Form); Image.Top := ScaleY(0); Image.Width := ScaleX(142); Image.Left := Form.ClientWidth - Image.Width; Image.Height := ScaleY(59); Image.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image.bmp')); Image.Parent := Form; DownImage := TBitmapImage.Create(Form); DownImage.Top := ScaleY(61); DownImage.Left := ScaleX(0); DownImage.Width := Form.ClientWidth; DownImage.Height := Form.ClientHeight - DownImage.Top; DownImage.BackColor := $EEE9EB; DownImage.Parent := Form; UpPanel := TPanel.Create(Form); UpPanel.Top := ScaleY(59); UpPanel.Width := Form.ClientWidth; UpPanel.Height := ScaleY(2); UpPanel.BevelOuter := bvLowered; UpPanel.Parent := Form; NameLabel := TLabel.Create(Form); NameLabel.Top := ScaleY(5); NameLabel.Left := ScaleX(16); NameLabel.Font.Style := [fsBold]; NameLabel.Caption := 'Внимание!'; NameLabel.Color := clWhite; NameLabel.Parent := Form; DescriptionLabel := TLabel.Create(Form); DescriptionLabel.Top := ScaleY(24); DescriptionLabel.Left := ScaleX(25); DescriptionLabel.Caption := 'Папка установки содержит посторонние файлы. Удалить их?'; DescriptionLabel.Color := clWhite; DescriptionLabel.Parent := Form; BeforeListBoxLabel := TLabel.Create(Form); BeforeListBoxLabel.Top := ScaleY(68); BeforeListBoxLabel.Left := ScaleX(25); BeforeListBoxLabel.Caption := 'Если Вы уверены, что хотите удалить папку установки со всеми указанными файлами,'#13 'нажмите Да.' BeforeListBoxLabel.Color := $EEE9EB; BeforeListBoxLabel.Parent := Form; DownPanel := TPanel.Create(Form); DownPanel.Left := ScaleX(65); DownPanel.Top := ScaleY(308); DownPanel.Width := ScaleX(435); DownPanel.Height := ScaleY(2); DownPanel.BevelOuter := bvLowered; DownPanel.Parent := Form; DownTextLabel := TLabel.Create(Form); DownTextLabel.Top := ScaleY(302); DownTextLabel.Caption := ' InstallShield'; DownTextLabel.Font.Color := $99A8AC; DownTextLabel.Color := $EEE9EB; DownTextLabel.Parent := Form; ExtraFilesList := TMemo.Create(Form); ExtraFilesList.Left := ScaleX(25); ExtraFilesList.Top := ScaleY(108); ExtraFilesList.Width := Form.ClientWidth - ScaleX(50); ExtraFilesList.Height := ScaleY(180); ExtraFilesList.Color := $EEE9EB; ExtraFilesList.Parent := Form; CancelButton := TButton.Create(Form); CancelButton.Parent := Form; CancelButton.Width := ScaleX(75); CancelButton.Height := ScaleY(23); CancelButton.Left := Form.ClientWidth - CancelButton.Width - ScaleX(20); CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10); CancelButton.Caption := 'Нет'; CancelButton.ModalResult := mrCancel; CancelButton.Cancel := True; DelButton := TButton.Create(Form); DelButton.Parent := Form; DelButton.Width := ScaleX(75); DelButton.Height := ScaleY(23); DelButton.Left := CancelButton.Left - DelButton.Width - ScaleX(10); DelButton.Top := Form.ClientHeight - ScaleY(23 + 10); DelButton.Caption := 'Да'; DelButton.ModalResult := mrOk; Form.ActiveControl := CancelButton; FillListBox(ExpandConstant('{app}'), '*', 1); if ExtraFilesList.Lines.Count = 0 then DeleteFiles() else if Form.ShowModal() = mrOk then DeleteFiles(); end; procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); begin if DirExists(ExpandConstant('{app}')) and (CurUninstallStep = usPostUninstall) then BrowseRemainedFiles(); end; |
| Всего записей: 872 | Зарегистр. 06-09-2003 | Отправлено: 12:11 27-07-2007 | Исправлено: Genri, 12:14 27-07-2007 |
|