I cannot disable alt+tab. What is wrong?
(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
or its constant name SPI_SETSCREENSAVERRUNNING
stems from Win95 and also only applies to that platform, it was never meant to work on WinNT (which includes i.e. 2000, XP, Vista, 7, 8, 10) platforms. Either you (who copied the code) or the author neglected this important detail.
You have to install a hook thru SetWindowsHookEx( WH_KEYBORD )
. Also see the similar question Keyboard hooking alt-tab causing strange behavior?