==== VioModeWait ====
**Bindings**: [[modewait#C bindings|C]], [[modewait#MASM bindings|MASM]]
This call allows a graphics mode application to be notified when it must restore its video mode, state, and modified display adapter registers. The return from this function call provides the notification.
//VioModeWait// (RequestType, NotifyType, Reserved)
//RequestType// (**USHORT**) - input
Application request event. RequestType = 0 indicates the application wants to be notified at the end of a pop-up to restore its mode. RequestType = 0 is the only event supported by [[modewait|VioModeWait]].
//NotifyType// (**PUSHORT**) - output
Address of the operation to be performed by the application returning from [[modewait|VioModeWait]]. //NotifyType// = 0, indicating restore mode, is the only type of notification returned.
//Reserved// (**USHORT**) - input
Reserved word of 0s.
//rc// (**USHORT**) - return
Return code descriptions are:
|0 |NO_ERROR |
|421 |ERROR_VIO_INVALID_PARMS |
|422 |ERROR_VIO_FUNCTION_OWNED |
|423 |ERROR_VIO_RETURN |
|424 |ERROR_SCS_INVALID_FUNCTION |
|428 |ERROR_VIO_NO_SAVE_RESTORE_THD |
|430 |ERROR_VIO_ILLEGAL_DURING_POPUP |
|465 |ERROR_VIO_DETACHED |
|494 |ERROR_VIO_EXTENDED_SG |
**Remarks**
At the completion of an application or hard error pop-up (reference [[popup|VioPopUp]]), OS/2 notifies the session that was originally interrupted for the pop-up to restore its mode. The return from this function call provides that notification. The thread that issued the call must perform the restore and then immediately re-issue [[modewait|VioModeWait]].
When an application's [[modewait|VioModeWait]] thread is notified, the thread must restore its video mode, state, and modified display adapter registers. An application's [[modewait|VioModeWait]] thread does not restore the physical display buffer. OS/2 saves/restores the physical display buffer over a pop-up.
Only one process for a session can issue [[modewait|VioModeWait]]. The first process that issues [[modewait|VioModeWait]] becomes the owner of this function. (Refer to [[modeundo|VioModeUndo]].)
An application must issue [[modewait|VioModeWait]] only if it writes directly to the registers on the display adapter. Otherwise, the application can allow OS/2 to perform the required restore by not issuing [[modewait|VioModeWait]].
When an application issues [[modewait|VioModeWait]], it is also required to issue [[savredrawwait|VioSavRedrawWait]] to be notified at screen switch time to perform a full save or restore (reference [[savredrawwait|VioSavRedrawWait]]. Two application threads must be dedicated to performing these operations.
=== C bindings ===
#define INCL_VIO
USHORT rc = VioModeWait(RequestType, NotifyType, Reserved);
USHORT RequestType; /* Request type */
PUSHORT NotifyType; /* Notify type (returned) */
USHORT Reserved; /* Reserved (must be zero) */
USHORT rc; /* return code */
=== MASM bindings ===
EXTRN VioModeWait:FAR
INCL_VIO EQU 1
PUSH WORD RequestType ;Request type
PUSH@ WORD NotifyType ;Notify type (returned)
PUSH WORD Reserved ;Reserved (must be zero)
CALL VioModeWait
Returns WORD