Resizing and Positioning Child Windows

To resize or reposition a window, use the _wsetsize function. Pass it an argument of type _wsizeinfo (see “Opening Child Windows” for information about the _wsizeinfo structure).

You can also examine the current size and position of a window by calling the _wgetsize function.

Summary: A child window cannot be larger than its client window.

Both resizing functions require a file handle argument and a _wsizeinfo argument. The _wgetsize function also requires an int argument specifying the “request type.” The request type can have one of two values: _WINCURRREQ, which returns the current size of the window, or _WINMAXREQ, which returns the maximum size to which the window can grow (it cannot exceed the current size of the client window). You can also query the size of the client (application) window. Pass the manifest constant _WINFRAMEHAND as the window handle to _wgetsize, which returns information about the client window.

The _type field of the _wsizeinfo structure can have one of four values: _WINSIZEMIN, for a minimized window; _WINSIZEMAX, for a maximized window; _WINSIZERESTORE, to restore a minimized window to its previous size; or _WINSIZECHAR, which allows you to specify (in the remaining fields of the _wsizeinfo structure) the coordinates of the window's upper-left corner and the window's height and width in characters.

To illustrate, the following code maximizes a child window:

FILE * fp; /* File handle to window */

struct _wsizeinfo ws; /* Size structure variable */

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

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

.

.

.

/* Set the window size */

result = _wsetsize( fileno( fp ), &ws );

The _wsetsize and _wgetsize functions return 0 if successful or –1 if not. The _wgetsize function also fills in the _wsizeinfo structure if successful. You can then extract the size information from the structure.

See QWDEMO.C for additional examples.

Note:

A child window cannot be larger than its client window.