home *** CD-ROM | disk | FTP | other *** search
- -----------------------------------------------------------
- RESTART
- A Windows Restart Utility
- 1993, Jeffrey M. Perkel
- -----------------------------------------------------------
-
- //////////////////////////////////////////////////
- Legal Stuff
- //////////////////////////////////////////////////
-
- This program is distributed as freeware. You are free to
- distribute it so long as this README.TXT file remains with
- it. You are also free to modify the code, but please e-mail
- me any suggestions or fixes or even (ack!) bugs, at
-
- perkel_j@a1.mscf.upenn.edu
-
- Windows is a registered trademark and is owned by Microsoft
- Corporation. All other tradenames are owned by their
- respective companies.
-
- The author accepts no liability for any problems that may
- occur during, or the be the result of use of, this program.
-
- //////////////////////////////////////////////////
- Why RESTART?
- //////////////////////////////////////////////////
-
- It is sometimes necessary to restart Windows in order to have
- changes in the system (i.e., WIN.INI, SYSTEM.INI) files take effect.
- RESTART allows you to do this without having to exit, and then
- restart.
-
- //////////////////////////////////////////////////
- Program Usage and Syntax
- //////////////////////////////////////////////////
-
- Syntax: RESTART [/R | E]
- Switches: R - Restart Windows
- E - Exit Windows
-
- NOTE: Invoking RESTART using the command line switches automatically
- turns confirmation on.
-
- RESTART, as its name implies, is a small utility that allows
- the user to restart Windows, or exit it. To use it, simply
- execute RESTART, select the desired action, and press Go!.
- You can quit the program by selecting Cancel, or Close in the
- system menu. The dialog box contains a "Confirmation On"
- checkbox. Uncheck this box to avoid the confirmation dialog
- box.
-
- You can set RESTART to run automatically by creating an icon in
- Program Manager. Simply create a new program icon, and then
- enter the command line switch that you desire. For example to
- have RESTART restart Windows without invoking the main dialog box,
- simply enter: C:\UTIL\RESTART /R.
-
- //////////////////////////////////////////////////
- Technical Details
- //////////////////////////////////////////////////
-
- RESTART is written in C and is compiled using Microsoft C/C++
- 7.0 and the Windows 3.1 SDK. The code is written based upon
- a similar design by Mike Sax, as originally written in Dr.
- Dobbs Journal (UNLOAD.EXE). The original code is available for
- anonymous FTP from SIMTEL20 as /pub/msdos/ddj/ddj0992.zip.
-
- When RESTART is invoked, it calls the function ParseCmdLine(),
- which determines if any command line switches have been used.
- If they have, the variable bCmdLineParam is set to TRUE, and,
- depending upon the switch, the variable Action is set either to
- EW_RESTARTWINDOWS or NULL (see below). If an incorrect switch
- is used, the program notifies the user and invokes the main
- dialog box.
-
- If no command line parameter has been used, the main dialog box
- is created normally, and RESTART waits for user input. The
- program works by checking the status of the radio buttons
- when Go! is pressed:
-
- int Action;
- BOOL bAnswer, bSuccess;
-
- Action = (IsDlgButtonChecked(hDlg, IDD_RESTART)) ?
- EW_RESTARTWINDOWS : (IsDlgButtonChecked (hDlg,
- IDD_EXIT)) ? NULL : NOCHECK;
- if (Action == NOCHECK)
- {
- MessageBeep(0);
- break;
- }
- bAnswer = AreYouSure (hDlg, Action);
- if (!bAnswer) break;
- bSuccess = MakeItSo (Action);
- if (!bSuccess) {
- MessageBox (hDlg, "One or more \
- applicatons refused to \
- terminate!", szAppName, MB_OK);
- }
- break;
-
- The MakeItSo() function simply passes the results of the
- IsDlgButtonChecked() call to ExitWindows():
-
- ExitWindows (Action, 0);
-
- ExitWindows() actually can accept 3 different options:
- EW_RESTARTWINDOWS, EW_REBOOTSYSTEM, or NULL. EW_REBOOTSYSTEM
- will cause Windows to terminate and the system to restart.
-
- /////////////////////////////////////////////////////
- Version History
- /////////////////////////////////////////////////////
-
- 10 August 1993 Ver. 1.0 First version.
- 15 August 1993 Ver. 1.0.1 Fixed a bug that caused RESTART to
- exit Windows if neither Dialog Button was checked.
- 18 August 1993 Ver. 1.1 Fixed a bug that prevented RESTART from
- exiting Windows. Added confirmation dialog boxes.
- 20 August 1993 Ver. 1.2 Added feature to allow user to turn off
- Confirmation dialog box. Added an About... box. (Thanks to
- Willem Bison wbison@xs4all.hacktic.nl for help with this!)
- 1 Sept. 1993 Ver. 1.3 Added command line switches and parsing.
- 7 Sept. 1993 Ver. 1.4 Modified ParseCmdLine() algorithm and
- optimized code slightly.
-
-