Sets a QuickWin window's screen-buffer size.
#include <io.h>
int _wsetscreenbuf( int wfh, long bufsiz );
wfh | File handle to a QuickWin window | |
bufsiz | Desired size of the window's screen buffer (in bytes) |
The _wsetscreenbuf function sets the size of a QuickWin window's screen buffer to bufsiz bytes. This size determines how much text is retained in the buffer and thus how much text you can scroll back through. 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 bufsiz argument can be specified as a number or as one of the following values:
Value | Meaning |
_WINBUFDEF | Use the default window screen-buffer size (2,048 bytes) |
_WINBUFINF | Use a window screen buffer of unlimited size |
The buffer size simply limits how big the buffer can become. The buffer is always allocated dynamically, so that it fits its contents. Specifying _WINBUFINF puts no upper limit on buffer size. The buffer may grow within the limits of available memory.
If successful, _wsetscreenbuf returns 0. A return value of –1 indicates an error.
Standards:None
16-Bit:QWIN
32-Bit:None
_fwopen, _wabout, _wclose, _wgetexit, _wgetfocus, _wgetscreenbuf, _wgetsize, _wmenuclick, _wopen, _wsetexit, _wsetfocus, _wsetsize
/* WSSCRBUF.C - Demonstrate setting the size of a QuickWin window's
* screen buffer
* Note: The size is set here to an amount smaller than the default
* size, but you can set it larger as well
*/
#include <io.h>
#include <stdio.h>
#define NUMWINS 4 /* Number of windows */
#define OPENFLAGS "w" /* Access permission */
#define NUMLINES 100 /* Lines of text to write */
void main( void )
{
int i; /* Loop variable */
int nSize; /* Old size of screen buffer */
int nWinBufSize = 1500L; /* New size */
int nRes; /* Result */
FILE *wp; /* File pointer */
/* Open a window */
/* NULL arguments accept default characteristics */
wp = _fwopen( NULL, NULL, OPENFLAGS );
if( wp == NULL )
{
printf( "***ERROR:_fwopen\n" );
exit( -1 );
}
/* Get the size of its screen buffer */
nSize = _wgetscreenbuf( _fileno( wp ) );
nRes = fprintf( wp, "Screen buffer holds %i chars\n", nSize );
/* Reset the screen buffer size */
nRes = _wsetscreenbuf( _fileno( wp ), nWinBufSize );
/* Write many lines in the window */
for( i = 0; i < NUMLINES; i++ )
{
nRes = fprintf( wp, "%i Windows!\n", i );
}
nRes = fprintf( wp, "\nWhen the program ends, click 'No'\n" );
nRes = fprintf( wp, "and try using the scroll bars\n" );
nRes = _wclose( _fileno( wp ), _WINPERSIST );
exit( 0 );
}