_wgetsize

Description

Gets a QuickWin window's current size and position on the screen.

#include <io.h>

int _wgetsize( int wfh, int reqtype, struct _wsizeinfo *wsize );

wfh File handle to a QuickWin window  
reqtype Type of request  
wsize Pointer to a _wsizeinfo structure  

Remarks

The _wgetsize function returns the size and position of the specified child window. 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 wfh argument is a handle to the window file. Use the manifest constant _WINFRAMEHAND as the value of wfh to query the size and position of the parent frame (client or application window). The maximum size of the parent frame may vary according to the hardware specifications of your terminal.

The reqtype argument is the type of request, which can have one of two values:

Value Meaning

_WINCURRREQ Return the current size of the window
_WINMAXREQ Return the maximum size that the window can grow to (which cannot exceed the current size of the parent frame)

The wsize argument is a pointer to a _wsizeinfo structure (declared in IO.H) that returns the size and position information. The structure contains a _type field that has one of the following values on return:

Value Meaning

_WINSIZEMIN Window is minimized
_WINSIZEMAX Window is maximized
_WINSIZECHAR Window is of the size specified in the structure's remaining members

If the type returned is _WINSIZECHAR, the _x, _y, _h, and _w values in the remainder of the structure specify the coordinates of the upper-left corner and the height and width of the window (in characters). Size returned always indicates the “client space” available in the parent frame, which means that it does not include space occupied by title bars and other parts of the window.

Return Value

If successful, _wgetsize returns 0 and fills in the _wsizeinfo structure. 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, _wmenuclick, _wopen, _wsetexit, _wsetfocus, _wsetscreenbuf, _wsetsize, _wyield

Example

/* 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( void )

{

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 = _WINVER;

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 );

}