DisableTaskSwitching
- Updated2023-02-21
- 3 minute(s) read
DisableTaskSwitching
void DisableTaskSwitching (void);
Purpose
![]() |
Note This function is obsolete. For information about alternative methods for disabling task switching on Windows 2000 and later, refer to the Alternatives on Windows 2000 and Later section in this topic. |
Prevents the user from using <Alt-Tab>, <Alt-Esc>, or <Ctrl-Esc> key combination to switch another task.
DisableTaskSwitching affects the behavior of these keys only while a LabWindows/CVI executable is the active application.
If you configure Windows 9x to hide the taskbar, DisableTaskSwitching also prevents the user from using the mouse to bring up the taskbar.
DisableTaskSwitching has no effect on Windows 2000 and later. Refer to the Alternatives on Windows 2000 and Later section in this function description for instructions on how to achieve the required effect.
![]() |
Note On Windows 98, DisableTaskSwitching requires the LabWindows/CVI low-level support driver. LabWindows/CVI loads the driver at startup if it is on disk. You can check whether LabWindows/CVI loaded the driver at startup by calling CVILowLevelSupportDriverLoaded. |
(Linux) This function is not supported.
Disabling the Task List
DisableTaskSwitching does not prevent the user from clicking on the taskbar on Windows 98. You can prevent the user from clicking on the desktop by forcing your window to cover the entire screen.
Forcing Window to Cover Entire Screen
You can force your window to cover the entire screen by making the following calls to functions in the User Interface Library.
SetPanelAttribute (panel, ATTR_SIZABLE, FALSE);
SetPanelAttribute (panel, ATTR_CAN_MINIMIZE, FALSE);
SetPanelAttribute (panel, ATTR_CAN_MAXIMIZE, FALSE);
SetPanelAttribute (panel, ATTR_SYSTEM_MENU_VISIBLE, FALSE);
SetPanelAttribute (panel, ATTR_MOVABLE, FALSE);
SetPanelAttribute (panel, ATTR_WINDOW_ZOOM, VAL_MAXIMIZE);
In these calls, panel is the panel handle for your top-level window.
Alternatives on Windows 98
On Windows 98, you can arrange for your stand-alone application to appear in place of the desktop when Windows boots.
You can do this by changing the following line in your system.ini [boot] section from:
shell = Explorer.exe
to:
shell = full-path-of-your-executable
Alternatives on Windows 2000 and Later
On Windows 2000 and later, you can obtain the same results as DisableTaskSwitching by specifying for your LabWindows/CVI application to appear in place of the Program Manager and by disabling the Task Manager. Complete the following changes to the registry entry for the key name:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
- Change the value for shell to the pathname of your application executable.
- Add a value with the name taskman. Set the data to an empty string.
Preventing Interference with Real-Time Processing
On Windows, many user actions can interfere with real-time processing. The following actions suspend the processing of events.
- Moving and sizing top-level windows
- Accessing the System menu
- Pressing the <Alt-Tab> key combination
You can prevent these user actions from interfering with event processing by performing the following actions:
- Call DisableTaskSwitching or use the alternative for Windows 2000 and later.
- Make all your top-level panels nonmovable and nonsizable.
- Do not use the Standard I/O Window in your final application.
- Make the following calls if you use any of the built-in pop-ups in the User Interface Library:
SetSystemPopupsAttribute (ATTR_MOVABLE, 0);
SetSystemPopupsAttribute (ATTR_SYSTEM_MENU_VISIBLE, 0);
An alternative approach is available on Windows 2000 and later. You can enable timer control callbacks while the user presses <Alt-Tab>, pulls down the System menu, or, in some cases, moves or sizes a window. You can do this by using the following function call:
SetSystemAttribute (ATTR_ALLOW_UNSAFE_TIMER_EVENTS, 1);
This alternative approach is incomplete and can be unsafe. Refer to the discussion on ATTR_ALLOW_UNSAFE_TIMER_EVENTS.
Parameters
None.
Return Value
None.
Additional Information
Library: Utility Library
Include file: utility.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later