APPNOTE: Alternatives to QuickWin Termination Message Box

ID: Q76368

The information in this article applies to:

SUMMARY

This application note provides three new functions as alternatives to terminating a QuickWin program. To obtain this application note, "Alternatives to QuickWin Termination Message Box," call Microsoft Product Support Services.

MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

 ~ HF0450.exe (size: 48971 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

The following is the text of the application note:

   Microsoft Product Support Services Application Note (Text File)
       HF0450: ALTERNATIVES TO QUICKWIN TERMINATION MESSAGE BOX
                                                   Revision Date: 9/91
                                                         Disk Included

The following information applies to Microsoft FORTRAN version 5.1.

 --------------------------------------------------------------------
| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |
| ACCOMPANY THIS DOCUMENT (collectively referred to as an            |
| Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      |
| KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO    |
| THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A     |
| PARTICULAR PURPOSE. The user assumes the entire risk as to the     |
| accuracy and the use of this Application Note. This Application    |
| Note may be copied and distributed subject to the following        |
| conditions: 1) All text must be copied without modification and    |
| all pages must be included; 2) If software is included, all files  |
| on the disk(s) must be copied without modification [the MS-DOS(R)  |
| utility DISKCOPY is appropriate for this purpose]; 3) All          |
| components of this Application Note must be distributed together;  |
| and 4) This Application Note may not be distributed for profit.    |
|                                                                    |
| Copyright 1991 Microsoft Corporation. All Rights Reserved.         |
| Microsoft, MS-DOS, and the Microsoft logo are registered           |
| trademarks and Windows is a trademark of Microsoft Corporation.    |
 --------------------------------------------------------------------

This application note illustrates how to modify the QuickWin default for program termination. Included on the enclosed "Alternatives to QuickWin Termination Message Box" disk are the files listed below; these files include the new object modules to be added to the QuickWin run-time library, a batch file that adds the object files to the QuickWin run-time library, and a sample program that asks the user which of the three available exit methods to use to terminate the application.

   File           Description
   ----           -----------

   EXMODE.FOR     FORTRAN QuickWin program example

   QWIN.LIB       Library of object modules to be added to the
                  QuickWin run-time library

   EXITMODE.OBJ   Additional object module to be added to the
                  QuickWin run-time library

   REPLACE.BAT    Batch file that modifies the existing QuickWin
                  run-time library to include QWIN.LIB and
                  EXITMODE.OBJ

   FLIB.FI        Updated FLIB.FI

   FLIB.FD        Updated FLIB.FD

There are three alternatives for terminating a QuickWin application:

1. A termination message box is displayed on conclusion of a QuickWin

   application, asking the user whether or not to close the
   application window. This is the default method.

2. No message box is displayed on conclusion of the QuickWin
   application, and the application window is closed.

3. No message box is displayed on conclusion of the QuickWin
   application, and the application window remains active.

Alternatives 2 and 3 require modification of the QuickWin run-time library and the FLIB.FI and FLIB.FD files.

Implementing the Alternative Exit Mode Functions

1. Copy the QWIN.LIB, EXITMODE.OBJ, and REPLACE.BAT files from the

   enclosed disk to your \FORTRAN\LIB directory.

2. Run the batch file REPLACE.BAT by typing "replace" (without the
   quotation marks) at the command prompt from within the
   \FORTRAN\LIB directory. Your existing LLIBFEW.LIB library will
   be changed.

3. Replace the FLIB.FI and FLIB.FD files in your \FORTRAN\INCLUDE
   directory with those on the enclosed disk.

After you make these modifications, two new functions (SETEXITQQ and GETEXITQQ) that control the termination message box mode will be available to you. The interfaces for these two functions are as follows:

    INTERFACE TO INTEGER*2 FUNCTION SETEXITQQ(EXITMODE)
        INTEGER*2 EXITMODE
    END

    INTERFACE TO INTEGER*2 FUNCTION GETEXITQQ()
    END

SETEXITQQ returns a 0 for success and a -1 for failure. The function will fail upon an incorrect argument. SETEXITQQ takes an argument of one of the following three constant values and sets the exit mode accordingly:

   Constant Value      Result
   --------------      ------

   QWIN$EXITPROMPT     Sets the exit mode to display the termination
                       message box (the default)

   QWIN$EXITNOPERSIST  Sets the exit mode to suppress the
                       termination message box and closes the
                       application window

   QWIN$EXITPERSIST    Sets the exit mode to suppress the termination
                       message box and leaves the application window
                       open

GETEXITQQ returns the current exit mode, which is one of the above constant values.

Running the Sample Program

After copying EXMODE.FOR to your hard disk, compile the program at the command prompt as follows:

    fl /MW exmode.for

Run the program as you would any QuickWin application, either by selecting EXMODE.EXE from the File Manager, by choosing Run from the File menu and typing the full path to EXMODE.EXE, or by typing the following at the command prompt:

    win exmode

The sample program prompts you for the desired exit mode (select 1 for QWIN$EXITPROMPT, 2 for QWIN$EXITNOPERSIST, or 3 for QWIN$EXITPERSIST). The program then uses GETEXITQQ to display the current exit mode and uses SETEXITQQ to set the exit mode to the desired value. If the exit mode is correctly set, the program then calls GETEXITQQ to display the new exit mode before exiting as directed.

Additional query words: Keywords : kbappnote kbfile kbLangFortran

Last Reviewed: December 12, 1998