Closes a QuickWin window's file handle.
#include <io.h>
int _wclose( int wfh, int persist );
wfh | File handle to a QuickWin window | |
persist | Flag indicating whether the window stays on the screen after closing |
The _wclose function closes a QuickWin window. The window must have been previously opened with the QuickWin function _wopen. 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).
To close a window opened with _wopen, pass its file handle to _wclose. To close a window opened with _fwopen, call the STDIO.H function fclose.
The persist flag can have one of the following values:
Value | Meaning |
_WINNOPERSIST | Erase the closed window |
_WINPERSIST | Leave the window on the screen |
If the window remains on the screen, another _wclose call to the same file handle with _WINNOPERSIST removes it. While the window remains visible, the user can copy and paste text in it, choose QuickWin menus, and operate the window's scroll bars.
Regardless of which persist option is used, the window's file handle is closed to all further I/O. If a window is opened with the same title as a window closed with persistence, it will be a different window. Windows closed with persistence count against the total number of open windows (20 by default).
If successful, _wclose returns 0. A return value of –1 indicates an error; errno is set to EBADF, indicating an invalid file-handle argument.
Standards:None
16-Bit:QWIN
32-Bit:None
_fwopen, _wabout, _wgetexit, _wgetfocus, _wgetscreenbuf, _wgetsize, _wmenuclick, _wopen, _wsetexit, _wsetfocus, _wsetscreenbuf, _wsetsize, _wyield
/* WCLOSE.C - Demonstrate closing QuickWin windows */
#include <fcntl.h>
#include <stdio.h>
#include <io.h>
#define PERSISTFLAG _WINNOPERSIST
#define OPENFLAGS _O_RDWR
void main( void )
{
int wfh; /* File handle for window */
int nRes; /* Window write results */
int wc; /* Window closure results */
struct _wopeninfo wininfo; /* Open information */
/* Set up window open information */
wininfo._version = _WINVER;
wininfo._title = "Window Closing";
wininfo._bufsize = _WINBUFDEF;
/* Open a window with _wopen */
wfh = _wopen( &wininfo, NULL, OPENFLAGS );
if( wfh == -1 )
{
printf( "***ERROR: On _wopen\n" );
exit( -1 );
}
/* Write in the window */
nRes = write( wfh, "Windows Everywhere!\n", 20 );
/* Close the window with _wclose */
wc = _wclose( wfh, PERSISTFLAG );
exit( 0 );
}