UninstSharedFileForm.pas 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. unit UninstSharedFileForm;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2004 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. "Remove Shared File" form
  8. $jrsoftware: issrc/Projects/UninstSharedFileForm.pas,v 1.5 2007/12/04 04:34:30 jr Exp $
  9. }
  10. interface
  11. uses
  12. Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  13. SetupForm, StdCtrls, NewStaticText, BidiCtrls;
  14. type
  15. TUninstSharedFileForm = class(TSetupForm)
  16. BodyLabel: TNewStaticText;
  17. FilenameLabel: TNewStaticText;
  18. FilenameEdit: TEdit;
  19. LocationLabel: TNewStaticText;
  20. LocationEdit: TEdit;
  21. YesButton: TNewButton;
  22. YesToAllButton: TNewButton;
  23. NoButton: TNewButton;
  24. NoToAllButton: TNewButton;
  25. private
  26. { Private declarations }
  27. protected
  28. procedure CreateParams(var Params: TCreateParams); override;
  29. public
  30. { Public declarations }
  31. constructor Create(AOwner: TComponent); override;
  32. end;
  33. function ExecuteRemoveSharedFileDlg(const Filename: String;
  34. var AAll: Boolean): Boolean;
  35. implementation
  36. uses
  37. PathFunc, Struct, Msgs, MsgIDs, Main;
  38. {$R *.DFM}
  39. const
  40. { These aren't defined on Delphi 2 }
  41. mrAll = mrNo + 1;
  42. mrNoToAll = mrAll + 1;
  43. mrYesToAll = mrNoToAll + 1;
  44. function ExecuteRemoveSharedFileDlg(const Filename: String;
  45. var AAll: Boolean): Boolean;
  46. var
  47. Form: TUninstSharedFileForm;
  48. Res: Integer;
  49. begin
  50. Form := TUninstSharedFileForm.Create(nil);
  51. try
  52. Form.FilenameEdit.Text := PathExtractName(Filename);
  53. Form.LocationEdit.Text := PathExtractDir(Filename);
  54. Res := Form.ShowModal;
  55. finally
  56. Form.Free;
  57. end;
  58. Result := (Res = mrYes) or (Res = mrYesToAll);
  59. AAll := (Res = mrYesToAll) or (Res = mrNoToAll);
  60. end;
  61. { TSelectLanguageForm }
  62. constructor TUninstSharedFileForm.Create(AOwner: TComponent);
  63. begin
  64. inherited;
  65. InitializeFont;
  66. Caption := SetupMessages[msgConfirmDeleteSharedFileTitle];
  67. BodyLabel.Caption := SetupMessages[msgConfirmDeleteSharedFile2];
  68. FilenameLabel.Caption := SetupMessages[msgSharedFileNameLabel];
  69. LocationLabel.Caption := SetupMessages[msgSharedFileLocationLabel];
  70. YesButton.Caption := SetupMessages[msgButtonYes];
  71. YesToAllButton.Caption := SetupMessages[msgButtonYesToAll];
  72. NoButton.Caption := SetupMessages[msgButtonNo];
  73. NoToAllButton.Caption := SetupMessages[msgButtonNoToAll];
  74. KeepSizeY := True;
  75. end;
  76. procedure TUninstSharedFileForm.CreateParams(var Params: TCreateParams);
  77. begin
  78. inherited;
  79. Params.WindowClass.style := Params.WindowClass.style or CS_NOCLOSE;
  80. end;
  81. end.