Sets the active page.
#include <graph.h>
short __far _setactivepage( short page );
page | Memory page number |
For hardware and mode configurations with enough memory to support multiple screen pages, _setactivepage specifies the area in memory in which output is written. The page argument selects the current active page. The default page number is 0.
Screen animation can be done by alternating the graphics pages displayed. Use the _setvisualpage function to display a completed graphics or text page while executing graphics statements in another active page.
These functions can also be used to control text output if you use the text functions _gettextcursor, _settextcursor, _outtext, _settextposition, _gettextposition, _settextcolor, _gettextcolor, _settextwindow, and _wrapon instead of the standard C-language I/O functions.
The CGA hardware configuration has only 16K of RAM available to support multiple video pages, and only in the text mode. The EGA and VGA configurations may be equipped with up to 256K of RAM for multiple video pages in graphics mode.
If successful, the function returns the page number of the previous active page. If the function fails, it returns a negative value.
Standards:None
16-Bit:DOS
32-Bit:None
_getactivepage, _getvisualpage, _setvisualpage
/* PAGE.C illustrates video page functions including:
* _getactivepage _getvisualpage _setactivepage _setvisualpage
*/
#include <conio.h>
#include <graph.h>
#include <stdlib.h>
void main( void )
{
short oldvpage, oldapage, page, row, col, line;
struct _videoconfig vc;
char buf[80];
_getvideoconfig( &vc );
if( vc.numvideopages < 4 )
exit( 1 ); /* Fail for monochrome */
oldapage = _getactivepage();
oldvpage = _getvisualpage();
_displaycursor( _GCURSOROFF );
/* Draw arrows in different place on each page. */
for( page = 1; page < 4; page++ )
{
_setactivepage( page );
_settextposition( 12, 16 * page );
_outtext( ">>>>>>>>" );
}
while( !_kbhit() )
/* Cycle through pages 1 to 3 to show moving image. */
for( page = 1; page < 4; page++ )
_setvisualpage( page );
_getch();
/* Restore original page (normally 0) to restore screen. */
_setactivepage( oldapage );
_setvisualpage( oldvpage );
_displaycursor( _GCURSORON );
exit( 0 );
}