_wmenuclick

Description

Chooses a QuickWin menu item.

#include <io.h>

int _wmenuclick( int menuitem );

menuitem Constant specifying which menu command to execute  

Remarks

The _wmenuclick function emulates the user choosing a command from the QuickWin Window menu. 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 menuitem argument is a manifest constant specifying one of four available menu commands:

Value Meaning

_WINTILE Tile the program's child windows
_WINCASCADE Cascade the program's child windows
_WINARRANGE Arrange icons at the bottom of the client window area
_WINSTATBAR Toggle the status bar

These are the only menu commands you can choose. Calling the function with one of these values performs the menu action.

Return Value

If successful, _wmenuclick returns 0. 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, _wgetsize, _wopen, _wsetexit, _wsetfocus, _wsetscreenbuf, _wsetsize

Example

/* WMENUCLK.C - Demonstrate choosing a menu

* command with the QuickWin _wmenuclick function

*/

#include <io.h>

#include <stdio.h>

#define NUMWINS 4 /* Number of windows */

#define OPENFLAGS "w" /* Access permission */

void main( void )

{

int i, nRes;

int wm; /* Menu click result */

int sf, gf; /* Set/Get focus results */

FILE *wins[NUMWINS]; /* Array of file pointers */

/* Open NUMWINS windows */

/* NULL arguments accept default characteristics */

for( i = 0; i < NUMWINS; i++ )

{

wins[i] = _fwopen( NULL, NULL, OPENFLAGS );

if( wins[i] == NULL )

{

printf( "***ERROR: On _fwopen #%i\n", i );

exit( -1 );

}

/* Write in each window */

nRes = fprintf( wins[i], "Windows!\n" );

}

/* Tile child windows with _wmenuclick */

wm = _wmenuclick( _WINTILE );

if( wm == -1 )

{

printf( "***ERROR: _wmenuclick\n" );

exit( -1 );

}

/* Pass the focus from window to window */

for( i = 0; i < NUMWINS; i++ )

{

sf = _wsetfocus( _fileno( wins[i] ) );

gf = _wgetfocus();

if(( sf == -1 ) || ( gf == -1 )

|| ( gf != _fileno( wins[i] ) ) )

{

printf( "***ERROR: _wsetfocus/_wgetfocus\n" );

exit( -1 );

}

}

nRes = _fcloseall();

exit( 0 );

}