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.
VioModeWait (1.2)
Overview                                            Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_VIO
 
USHORT VioModeWait(fEvent, pfNotify, hvio)
USHORT fEvent;       /* event flag                          */
PUSHORT pfNotify;    /* pointer to variable for notify flag */
USHORT hvio;         /* video handle                        */
 
The VioModeWait function waits for a change in the current video mode before
returning. When a change occurs, MS OS/2 sets the variable pointed to by the
pfNotify parameter to a value indicating the type of change. The thread may
then restore the video registers or carry out other tasks related to
restoring the video mode for the process.
 
The VioModeWait function is used typically by graphics programs (or text
programs that access video registers directly) to restore the screen after a
pop-up screen has closed. Pop-up screens often change the video mode and
video-register values without fully restoring them when closed. A thread
that calls the VioModeWait function waits until a pop-up screen closes so
that it can restore the screen.
 
MS OS/2 permits only one process in a screen group to wait for a video-mode
change. The first process to make a request owns it.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
fEvent     Specifies the event flag of the event to wait for. If this
           parameter is VMWR_POPUP, the function waits for a pop-up screen
           to close. No other flags are permitted.
 
pfNotify   Points to the variable that receives a flag specifying the action
           to carry out in response to the given event. If this flag is
           VMWN_POPUP, the process should restore the video mode. No other
           values are returned.
 
hvio       Identifies an advanced video-input-and-output (AVIO) presentation
           space. For AVIO programs, this handle must have been created
           previously using the VioCreatePS function. For other programs,
           hvio 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_FUNCTION_OWNED
     ERROR_VIO_INVALID_PARMS
     ERROR_VIO_RETURN
 
Comments
 
A program should use the VioModeWait function if it changes the video
registers directly. MS OS/2 automatically saves and restores the physical
video buffer and screen mode whenever a pop-up screen is used.
 
The thread that calls VioModeWait should carry out only those tasks directly
related to restoring the screen mode. Whenever a mode change occurs, the
thread should restore the mode and call VioModeWait as quickly as possible.
The thread should not call MS OS/2 functions (netiher directly nor
indirectly through other functions) that may generate pop-up screens or
error pop-up screens. Doing so may cause MS OS/2 to lock up (that is, each
call of the thread generates a pop-up screen, which in turn calls the thread
and generates another pop-up screen, and so on). You can use the
VioModeUndo function to end the thread when it is no longer needed.
 
Programs that save and restore the video mode and screen before and after a
screen switch should use the VioSavRedrawWait function.
 
See Also
 
VioCreatePS, VioModeUndo, VioPopUp, VioSavRedrawWait