subcalls.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
VioSetMode (1.2)
Overview  Changes                                 Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_VIO
 
USHORT VioSetMode(pviomi, hvio)
PVIOMODEINFO pviomi;    /* pointer to structure for screen mode */
HVIO hvio;              /* video handle                         */
 
The VioSetMode function sets the screen mode. The screen mode defines the
display mode (text or graphics), the number of colors being used (2, 4, or
16), and the width and height of the screen in both character cells and
pels. VioSetMode also initializes the cursor position and type but does not
clear the screen.
 
The VioSetMode function is a family API function.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
pviomi     Points to the VIOMODEINFO structure that specifies the screen
           mode.
 
hvio       This parameter must be NULL.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
 
     ERROR_VIO_INVALID_HANDLE
     ERROR_VIO_INVALID_LENGTH
     ERROR_VIO_MODE
 
Comments
 
Not all screen-mode values are valid for all displays.
 
The hvio parameter can be only NULL. This function cannot be used by an
advanced video-input-and-output application.
 
When VioSetMode is called from a VIO-window application (as opposed to an
application that is running in its own screen group), it does not change the
size of a character cell.
 
Example
 
This example calls the VioGetMode function to retrieve the current display
mode, changes the mode, and calls VioSetMode to enable the new display
mode.
 
VIOMODEINFO viomi;
viomi.cb = sizeof(viomi);
VioGetMode(&viomi, 0);
if (viomi.vres > 350)                          /* VGA display */
    viomi.row = (viomi.row == 50) ? 25 : 50;
else                                           /* EGA display */
    viomi.row = (viomi.row == 43) ? 25 : 43;
VioSetMode(&viomi, 0);
 
See Also
 
VioGetMode, VioSetState, VIOMODEINFO