C Language and Libraries Help (clang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
WGETSIZE.C
◄Up► ◄Contents► ◄Index► ◄Back►
─────Run-Time Library───────────────────────────────────────────────────────
/* WGETSIZE.C - Demonstrate getting the
* size of a QuickWin window on the screen
*/
#include <io.h>
#include <stdio.h>
#define OPENFLAGS "w" /* Access permission */
#define PERSISTFLAG _WINPERSIST /* Keep on screen */
void main()
{
int nRes; /* Result */
FILE *wp; /* File pointer */
struct _wsizeinfo ws; /* Size information */
/* Open a window */
/* NULL arguments accept default characteristics */
wp = _fwopen( NULL, NULL, OPENFLAGS );
if( wp == NULL )
{
printf( "***ERROR:_fwopen\n" );
exit( -1 );
}
/* Get the window's size and screen position */
ws._version = _QWINVER;
nRes = _wgetsize( _fileno( wp ), _WINCURRREQ, &ws );
if( nRes == -1 )
{
printf( "***ERROR: _wgetsize\n" );
exit( -1 );
}
nRes = fprintf( wp, "Size:\n" );
nRes = fprintf( wp, " Upper Left: x = %d\n", ws._x );
nRes = fprintf( wp, " y = %d\n", ws._y );
nRes = fprintf( wp, " Width: w = %d\n", ws._w );
nRes = fprintf( wp, " Height: h = %d\n", ws._h );
nRes = _wclose( _fileno( wp ), PERSISTFLAG );
exit( 0 );
}
-♦-