Sometimes it is useful to leave your program's windows on the screen after the program terminates. This allows the user to inspect their contents, use the scroll bars, use the menus, and copy or paste text in the windows.
As described previously, you can use _wclose to control whether your program's windows remain on the screen. QuickWin also gives you additional control over the behavior of your windows when the program calls the exit function.
By default, your windows remain on the screen. But you can alter this default behavior by calling the _wsetexit function. You can get the current exit setting at any time by calling the _wgetexit function.
Call _wsetexit at any time to specify the state of your windows upon exit. If the exit function is subsequently called, the behavior is based on the value you set. You can pass one of the following manifest constants to _wsetexit:
_WINEXITPROMPT
Prompts the user with a dialog box; the user can specify the behavior
_WINEXITNOPERSIST
Windows do not remain on the screen
_WINEXITPERSIST
Windows remain on the screen (default value)
The _wsetexit function returns 0 if successful, or –1 if not.
Call _wgetexit to learn what the current exit setting is. The function returns the current setting (one of the values above) if successful, or –1 if not.
The following code demonstrates the use of _wsetexit and _wgetexit to determine the current exit setting and then to reset it:.
nExit = _wgetexit();
if( nExit == _WINPERSIST )
_wsetexit( _WINNOPERSIST );