◄Up► ◄Contents► ◄Index► ◄Back► ─────Run-Time Library─────────────────────────────────────────────────────── /* WSETFOC.C - Demonstrate making a new * QuickWin window the active window * with _wsetfocus */ #include <io.h> #include <stdio.h> #define NUMWINS 4 /* Number of windows */ #define OPENFLAGS "w" /* Access permission */ void main() { int i, wm, nRes; 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 ); } -♦-