禁用 alt+tab

Disable alt+tab

我无法禁用 alt+tab。怎么了?

(1)

var I: LongBool;
SystemParametersInfo(97,Word(true),@I,0);

(2)

procedure TfrmRelatorio.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);

keypreview:=true;
if (Key = VK_Tab) and (ssAlt in Shift) then
Key := 0;

97 或其常量名称 SPI_SETSCREENSAVERRUNNING 源于 Win95,并且也仅适用于该平台,它从未打算在 WinNT(包括 2000、XP、Vista、7、 8、10) 平台。要么是你(复制代码的人)要么是作者忽略了这个重要的细节。

您必须通过 SetWindowsHookEx( WH_KEYBORD ). Also see the similar question Keyboard hooking alt-tab causing strange behavior?

安装挂钩