共用方式為


Using the IgnoreAltTab Fix

Applies To: Windows 7, Windows Vista

This section includes information about using the IgnoreAltTab compatibility fix, including the associated issues, the intercepted application programming interface (API) details, the available command-line options, the included modules, and suggested solutions.

IgnoreAltTab

The IgnoreAltTab compatibility fix addresses issues with applications that have trouble with special key combinations, in particular if the combinations cause the application to leave full-screen mode. This fix is typically required for games.

This fix works by calling the SetWindowHookEx(WH_KEYBOARD_LL, …) function to install a low-level keyboard hook, which then implements a LowLevelKeyboardProc function to handle key presses and filter out the following key combinations:

  • ALT + TAB

  • ALT + ESC

  • CTRL + ESC

  • Windows logo key (both left and right)

  • Application Key [Microsoft Natural Keyboard only]

If the compatibility fix detects any of the listed keys or keyboard combinations, it returns a TRUE value; otherwise, it returns the CallNextHookEx(…) function, which causes the keyboard hook message to run on a new thread that is created for the process.

This fix attempts to stay at the end of the hook chain by hooking as early as possible and by allowing previous keyboard hooks to attempt to process the keyboard events before the fix processes them out.

Investigating the Issue

Special keyboard stroke handling can be tested by using each of the special keyboard sequences to determine if they are handled properly.

Note

For more information and specific tests that you can run, see the 2.6 Support Concurrent User Sessions section in the Games for Windows Test Requirements document.

Intercepted APIs

The IgnoreAltTab compatibility fix intercepts the RegisterRawInputDevices API, which causes the call to fail with an ERROR_INVALID_PARAMETER code and prevents the delivery of the WM_INPUT messages. This delivery failure forces the included hooks to be ignored and forces DInput to use Windows-specific hooks.

Command-Line Options

The following table provides details for each of the available command-line options.

Option Description

NOKEYS

Disables the ability to turn off the Filter Keys and Sticky Keys functionality. This behavior is considered the default.

OPENGL

Does not allow the compatibility fix to be applied if the computer is running in hardware-accelerated OpenGL mode.

Included Modules

The following modules are included in the IgnoreAltTab compatibility fix.

  • dinput.dll

  • dinput8.dll

  • dinput9.dll

Fixing Your Code

You can address this issue by disabling the shortcut keys, or by responding to lost devices if you are running a full screen DirectX game.

Note

For more information, see the Disabling Shortcut Keys in Games and the Lost Devices (Direct3D 9) technical articles.

See Also

Concepts

Windows Vista and Windows 7 Operating Systems