home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 April A / Pcwk4a98.iso / PROGRAM / DELPHI16 / Calmira / Src / SRC / SHUTDOWN.PAS < prev    next >
Pascal/Delphi Source File  |  1997-02-15  |  3KB  |  88 lines

  1. {**************************************************************************}
  2. {                                                                          }
  3. {    Calmira shell for Microsoft« Windows(TM) 3.1                          }
  4. {    Source Release 1.0                                                    }
  5. {    Copyright (C) 1997  Li-Hsin Huang                                     }
  6. {                                                                          }
  7. {    This program is free software; you can redistribute it and/or modify  }
  8. {    it under the terms of the GNU General Public License as published by  }
  9. {    the Free Software Foundation; either version 2 of the License, or     }
  10. {    (at your option) any later version.                                   }
  11. {                                                                          }
  12. {    This program is distributed in the hope that it will be useful,       }
  13. {    but WITHOUT ANY WARRANTY; without even the implied warranty of        }
  14. {    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         }
  15. {    GNU General Public License for more details.                          }
  16. {                                                                          }
  17. {    You should have received a copy of the GNU General Public License     }
  18. {    along with this program; if not, write to the Free Software           }
  19. {    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             }
  20. {                                                                          }
  21. {**************************************************************************}
  22.  
  23. unit Shutdown;
  24.  
  25. interface
  26.  
  27. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  28.   StdCtrls, ExtCtrls, Messages;
  29.  
  30. type
  31.   TQuitDlg = class(TForm)
  32.     OKBtn: TBitBtn;
  33.     CancelBtn: TBitBtn;
  34.     rbDOS: TRadioButton;
  35.     rbQuit: TRadioButton;
  36.     rbRestart: TRadioButton;
  37.     rbReboot: TRadioButton;
  38.     Bevel1: TBevel;
  39.     Image1: TImage;
  40.     procedure OKBtnClick(Sender: TObject);
  41.     procedure FormCreate(Sender: TObject);
  42.     procedure FormShow(Sender: TObject);
  43.     procedure rbDOSDblClick(Sender: TObject);
  44.   private
  45.     { Private declarations }
  46.   public
  47.     { Public declarations }
  48.   end;
  49.  
  50.  
  51. implementation
  52.  
  53. {$R *.DFM}
  54.  
  55. uses MiscUtil, Settings, Desk;
  56.  
  57. {var QuitDlg: TQuitDlg;}
  58.  
  59. procedure TQuitDlg.OKBtnClick(Sender: TObject);
  60. begin
  61.   Close;
  62.   DestroyHandle;
  63.   Desktop.Save;
  64.   case GetRadioIndex([rbDOS, rbQuit, rbRestart, rbReboot]) of
  65.    0: ExitWindows(0, 0);
  66.    1: Application.Terminate;
  67.    2: ExitWindows(EW_RESTARTWINDOWS, 0);
  68.    3: ExitWindows(EW_REBOOTSYSTEM, 0);
  69.   end;
  70. end;
  71.  
  72. procedure TQuitDlg.FormCreate(Sender: TObject);
  73. begin
  74.   rbQuit.Enabled := not IsShell;
  75. end;
  76.  
  77. procedure TQuitDlg.FormShow(Sender: TObject);
  78. begin
  79.   SetSysModalWindow(Handle);
  80. end;
  81.  
  82. procedure TQuitDlg.rbDOSDblClick(Sender: TObject);
  83. begin
  84.   OKBtn.Click;
  85. end;
  86.  
  87. end.
  88.