_wsetexit

Description

Specifies what a QuickWin application does when it exits (with a call to the exit function).

#include <io.h>

int _wsetexit( int exb );

exb Desired exit behavior type  

Remarks

QuickWin programs can optionally keep their windows on the screen after termination. How a program behaves at exit time depends on its current exit behavior setting. The _wsetexit function sets the 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).

The _wsetexit function takes one of three arguments:

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 _WINEXITPERSIST is passed, or if _WINEXITPROMPT is passed and the user chooses to keep the windows on the screen, the windows stay visible, their contents can be copied and pasted, and their scroll bars can be used, but the windows are closed to further I/O. See _wclose. The default exit behavior is _WINEXITPERSIST if you do not call _wsetexit.

Return Value

If successful, _wsetexit returns 0. A return value of –1 indicates an error.

Compatibility

Standards:None

16-Bit:QWIN

32-Bit:None

See Also

_fwopen, _wabout, _wclose, _wgetexit, _wgetfocus, _wgetscreenbuf, _wgetsize, _wmenuclick, _wopen, _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 );

}