home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / VRAC / RSTART14.ZIP / README.TXT < prev    next >
Encoding:
Text File  |  1993-09-07  |  5.0 KB  |  128 lines

  1. -----------------------------------------------------------
  2.                         RESTART
  3.                 A Windows Restart Utility
  4.                  1993, Jeffrey M. Perkel
  5. -----------------------------------------------------------
  6.  
  7. //////////////////////////////////////////////////
  8. Legal Stuff
  9. //////////////////////////////////////////////////
  10.  
  11. This program is distributed as freeware.  You are free to
  12. distribute it so long as this README.TXT file remains with
  13. it.  You are also free to modify the code, but please e-mail
  14. me any suggestions or fixes or even (ack!) bugs, at
  15.  
  16.                 perkel_j@a1.mscf.upenn.edu
  17.  
  18. Windows is a registered trademark and is owned by Microsoft
  19. Corporation.  All other tradenames are owned by their 
  20. respective companies.  
  21.  
  22. The author accepts no liability for any problems that may
  23. occur during, or the be the result of use of, this program. 
  24.  
  25. //////////////////////////////////////////////////
  26. Why RESTART?
  27. //////////////////////////////////////////////////
  28.  
  29. It is sometimes necessary to restart Windows in order to have 
  30. changes in the system (i.e., WIN.INI, SYSTEM.INI) files take effect.
  31. RESTART allows you to do this without having to exit, and then
  32. restart.
  33.  
  34. //////////////////////////////////////////////////
  35. Program Usage and Syntax
  36. //////////////////////////////////////////////////
  37.  
  38. Syntax:  RESTART [/R | E]
  39.         Switches:  R - Restart Windows
  40.                    E - Exit Windows
  41.  
  42. NOTE:  Invoking RESTART using the command line switches automatically 
  43. turns confirmation on.
  44.  
  45. RESTART, as its name implies, is a small utility that allows 
  46. the user to restart Windows, or exit it.  To use it, simply 
  47. execute RESTART, select the desired action, and press Go!. 
  48. You can quit the program by selecting Cancel, or Close in the
  49. system menu. The dialog box contains a "Confirmation On" 
  50. checkbox. Uncheck this box to avoid the confirmation dialog
  51. box.
  52.  
  53. You can set RESTART to run automatically by creating an icon in
  54. Program Manager.  Simply create a new program icon, and then
  55. enter the command line switch that you desire.  For example to
  56. have RESTART restart Windows without invoking the main dialog box,
  57. simply enter:  C:\UTIL\RESTART /R.
  58.  
  59. //////////////////////////////////////////////////
  60. Technical Details
  61. //////////////////////////////////////////////////
  62.  
  63. RESTART is written in C and is compiled using Microsoft C/C++
  64. 7.0 and the Windows 3.1 SDK.  The code is written based upon
  65. a similar design by Mike Sax, as originally written in Dr. 
  66. Dobbs Journal (UNLOAD.EXE).  The original code is available for
  67. anonymous FTP from SIMTEL20 as /pub/msdos/ddj/ddj0992.zip.  
  68.  
  69. When RESTART is invoked, it calls the function ParseCmdLine(),
  70. which determines if any command line switches have been used.
  71. If they have, the variable bCmdLineParam is set to TRUE, and,
  72. depending upon the switch, the variable Action is set either to
  73. EW_RESTARTWINDOWS or NULL (see below).  If an incorrect switch
  74. is used, the program notifies the user and invokes the main
  75. dialog box.
  76.  
  77. If no command line parameter has been used, the main dialog box
  78. is created normally, and RESTART waits for user input.  The
  79. program works by checking the status of the radio buttons
  80. when Go! is pressed:
  81.  
  82.         int Action;
  83.         BOOL bAnswer, bSuccess;
  84.         
  85.         Action = (IsDlgButtonChecked(hDlg, IDD_RESTART)) ?
  86.                 EW_RESTARTWINDOWS : (IsDlgButtonChecked (hDlg, 
  87.                 IDD_EXIT)) ? NULL : NOCHECK;
  88.         if (Action == NOCHECK)
  89.                 {
  90.                 MessageBeep(0);
  91.                 break;
  92.                 }
  93.         bAnswer = AreYouSure (hDlg, Action);
  94.         if (!bAnswer) break;
  95.         bSuccess = MakeItSo (Action);
  96.         if (!bSuccess) {
  97.                 MessageBox (hDlg, "One or more  \
  98.                 applicatons refused to          \
  99.                 terminate!", szAppName, MB_OK);
  100.                 }
  101.         break;
  102.         
  103. The MakeItSo() function simply passes the results of the
  104. IsDlgButtonChecked() call to ExitWindows():
  105.  
  106.         ExitWindows (Action, 0);
  107.  
  108. ExitWindows() actually can accept 3 different options:
  109. EW_RESTARTWINDOWS, EW_REBOOTSYSTEM, or NULL.  EW_REBOOTSYSTEM
  110. will cause Windows to terminate and the system to restart.
  111.  
  112. /////////////////////////////////////////////////////
  113. Version History
  114. /////////////////////////////////////////////////////
  115.  
  116. 10 August 1993  Ver. 1.0        First version.
  117. 15 August 1993  Ver. 1.0.1      Fixed a bug that caused RESTART to
  118.         exit Windows if neither Dialog Button was checked.
  119. 18 August 1993  Ver. 1.1        Fixed a bug that prevented RESTART from 
  120.         exiting Windows.  Added confirmation dialog boxes.
  121. 20 August 1993  Ver. 1.2        Added feature to allow user to turn off
  122.         Confirmation dialog box.  Added an About... box.  (Thanks to
  123.         Willem Bison wbison@xs4all.hacktic.nl for help with this!)
  124. 1 Sept. 1993    Ver. 1.3        Added command line switches and parsing.
  125. 7 Sept. 1993    Ver. 1.4        Modified ParseCmdLine() algorithm and
  126.         optimized code slightly.        
  127.      
  128.