_wgetexit

Description

Returns a value that indicates how a QuickWin program will behave when the exit function is called.

#include <io.h>

int _wgetexit( void );

Remarks

QuickWin programs can optionally keep their windows on the screen after termination. How a program will behave at exit time depends on its current exit behavior setting. The _wgetexit function lets you examine the current exit behavior setting. This routine is used only in QuickWin programs; it is not part of the Windows API. For full details about QuickWin, see Chapter 8 of Programming Techniques (in the Microsoft C/C++ version 7.0 documentation set).

If the companion function _wsetexit has been called previously, _wgetexit returns the value that it set. This can be one of the following values:

Value Meaning

_WINEXITPROMPT Prompt the user at exit time to determine whether the windows stay on the screen
_WINEXITNOPERSIST The windows do not stay on the screen and there is no prompt to the user
_WINEXITPERSIST The windows stay on the screen at exit

If _wsetexit has not been called previously, the _wgetexit function returns _WINEXITPERSIST, the default exit behavior. For a description of how to use this exit behavior, see _wsetexit.

Return Value

If successful, _wgetexit returns the current exit behavior setting value: _WINEXITPROMPT, _WINEXITNOPERSIST, or _WINEXITPERSIST. A return value of –1 indicates an error.

Compatibility

Standards:None

16-Bit:QWIN

32-Bit:None

See Also

_fwopen, _wabout, _wclose, _wgetfocus, _wgetscreenbuf, _wgetsize, _wmenuclick, _wopen, _wsetexit, _wsetfocus, _wsetscreenbuf, _wsetsize, _wyield

Example

/* FWOPEN.C - Demonstrate opening QuickWin windows with _fwopen

* Also demonstrate setting and getting exit behavior for QuickWin

*/

#include <io.h>

#include <stdio.h>

#define OPENFLAGS "w" /* Access permission */

void main( void )

{

struct _wopeninfo wininfo; /* Open information */

char wintitle[32]="QuickWin "; /* Title for window */

FILE *wp; /* FILE ptr to window */

int nRes; /* I/O result */

/* Set up window info structure for _fwopen */

wininfo._version = _WINVER;

wininfo._title = wintitle;

wininfo._wbufsize = _WINBUFDEF;

/* Check current 'exit behavior' setting */

/* Test should be true, since default is _WINEXITPERSIST */

/* So set new behavior to prompt user */

if( _wgetexit == _WINEXITPERSIST )

_wsetexit( _WINEXITPROMPT );

/* Create a new window */

/* NULL second argument accepts default size/position */

wp = _fwopen( &wininfo, NULL, OPENFLAGS );

if( wp == NULL )

{

printf( "***ERROR: _fwopen\n" );

exit( -1 );

}

/* Write in the window */

nRes = fprintf( wp, "Hello, QuickWin!\n" );

/* Close the window */

nRes = fclose( wp );

/* On exiting anywhere, user is prompted

* to keep window on screen or not

*/

exit( 0 );

}