INF: Keeping a DOS Window Active Under Standard and Real Mode

ID Number: Q75433

3.00

WINDOWS

Summary:

When a DOS (non-Windows) application running in a DOS window is in the

process of performing "critical" activity (such as asynchronous

network communication), switching away from the application could

result in the loss of data or a system crash. Under standard mode and

real mode Windows, a DOS application can prevent Windows from

switching away from it. This scheme can also be used by an application

run before Windows is started to prevent switching away from a DOS

application.

To implement this method, an application hooks interrupt 6Fh. Before

switching away from a DOS application, Windows makes an int 6Fh call

with the AX register set to 204h. This call is made if any application

has hooked int 6Fh. If the AX register contains 0 on return from the

interrupt, the switch is allowed; otherwise, the switch is prevented.

This technique can cause problems if the only applications that hook

int 6Fh that are running in the system do not use this convention. In

that case, no switching will be allowed. To avoid this situation, the

int 6Fh call can be disabled from the SYSTEM.INI file. In the

[NonWindowsApp] section, a TaskSwitchInt6f=OFF entry disables the int

6Fh.

Although this method can be used by an application running under the

MS-DOS 5.0 task switcher, a full-fledged application programming

interface related to switching has been implemented. These functions

would be much more useful for applications.