The MS-DOS versions 5 and 6 and Microsoft® Windows® operating systems provide support for task-switching MS-DOS applications. This is a facility that allows the user to switch between multiple applications running on the machine. When an application is not the currently running foreground task, it can be swapped out of memory onto disk by the operating system.
Due to the asynchronous nature of the DL-BASE interface, it is important that this task-switching operation is detected. If the user task switches from an emulator running in the foreground to another application, and the emulator is removed from memory, it is important that the DL-BASE does not attempt to call the emulator's routing procedure with any received messages.
Task-switching support is handled by the DMOD, and need not concern the 3270 emulator writer. However, the DMOD provides a means for the application to make use of the task switch detection. The emulator can call RegisterSwitchProc to register a procedure that will be called whenever an application is being switched out or back in.
If the emulator changes the screen mode (for example, to support model 5 emulation), the task switch notification mechanism must be used to restore the screen mode to its default when the application is being switched out. This is because Windows does not restore the screen mode before attempting to redraw the screen.