Setting the Window Size

When you open a child window you can accept its default size, or specifically set a size with the _wsetsize function.

The _wsetsize function receives size data in a _wsizeinfo structure:

struct _wsizeinfo {

unsigned int _version;

unsigned int _type;

unsigned int _x;

unsigned int _y;

unsigned int _h;

unsigned int _w;

};

To set the window's size, declare a variable of type _wsizeinfo and fill in its fields according to the size of the window you want to create.

_version

Windows version number. Use the constant _WINVER

_type

The size for the window, which can be one of the following:

_WINSIZEMIN

Minimizes the window

_WINSIZEMAX

Maximizes the window

_WINSIZERESTORE

Restores a minimized window

_WINSIZECHAR

Uses the listed coordinates for the window size

_x, _y, _h, _w

The coordinates of the upper-left corner of the window, the window's height, and the window's width, respectively. These values are in character coordinates.

If you set _type to _WINSIZEMIN, _WINSIZEMAX, or _WINSIZERESTORE, the _x, _y, _h, and _w fields can be left blank.

For example, the following code maximizes a child window:

int fh; /* File handle to child */

struct _wsizeinfo ws; /* Size structure variable */

ws._version = _WINVER; /* Version value */

ws._type = _WINSIZEMAX; /* Maximize window */

.

.

.

wsr = _wsetsize(fh, &ws); /* Set the window size */

NOTE:

A child window cannot be bigger than the parent window.

You can query the size of an open window with the _wgetsize function, which returns the window's size using the same _wsizeinfo structure.