----------------------------------------------------------- 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. ////////////////////////////////////////////////// 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 ////////////////////////////////////////////////// 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. ////////////////////////////////////////////////// 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. 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; } MakeItSo (Action); 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.