ID: Q80822
NoSwitch.exe is a sample application that demonstrates how an application can disable the task switch. Certain types of applications, such as security applications and possibly some setup programs, require the ability to disable task switching under Windows. To disable task switching, the program must prevent the user from accessing the Task List, using mouse or keystroke combinations to switch to other applications, and so forth.
The following file is available for download from the Microsoft Software Library:
~ NoSwitch.exe (size: 24034 bytes)
For more information about downloading files from the Microsoft Software
Library, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q119591
TITLE : How to Obtain Microsoft Support Files from Online Services
NOSWITCH demonstrates how an application can disable task switching. The
application must take the following four steps to disable task switching:
1. Subclass the desktop window to prevent the Task List from being
displayed when the user double-clicks the desktop window.
2. Prevent the user from using key combinations to switch to another
task by trapping the following three wParam values for the
WM_SYSCOMMAND message: SC_NEXTWINDOW, SC_PREVWINDOW, and
SC_TASKLIST.
3. Prevent other applications from activating themselves by
enumerating all top-level windows, and disabling the windows that
do not belong to this application.
4. Each time a WM_INITMEMUPOPUP message is received for the system
menu, disable the menu items that relate to switching tasks.
Before exiting the application, reverse the effects of any actions taken to
prevent switching tasks. Refer to the NOSWITCH sample for complete details.
There is a simpler, more limited, method to disable task switching. If the application is run as a maximized window, then step 2 above is enough to prevent switching tasks. However, the application must prevent the window from being restored or minimized. The limitation to this method is that the application must run as a maximized window.
Additional query words: Keywords : kbfile kbsample kb16bitonly kbGrpUser kbWinOS310 kbWndw kbWinOS300
Last Reviewed: December 24, 1998