This snippet will disable ctrl+alt+del keys by modifying the registry scancode mapping, this code will works on xp-w8, you have to restart computer to make this works.
Code:
procedure TfrmMain.DisableCtrAltDel(boolState: Boolean);
{
Author : Teofilus
e-mail : delphifocus[at]gmail[dot]com
Compiler : Borland Delphi 7 Enterprise
Description : Disable [ctrl]+[alt]+[del] keys - works on XP/Vista/W7
}
var
SystemReg: TRegistry; // Add Registry unit to uses
Data: Array[1..48] of Byte; // Static Array 48 byte
i: Byte;
begin
try
{ Initialize "Scan Code" Value with $00}
for i := 1 to 48 do
data[i] := $00;
{ Change certain byte }
data[ 9] := $09;
data[15] := $5B;
data[16] := $E0;
data[19] := $5C;
data[20] := $E0;
data[23] := $5D;
data[24] := $E0;
data[27] := $44;
data[31] := $1D;
data[35] := $38;
data[39] := $1D;
data[40] := $E0;
data[43] := $38;
data[44] := $E0;
{ End of "Scan Code" Value }
try
SystemReg := TRegistry.Create;
with SystemReg do
begin
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('\System\CurrentControlSet\Control\Keyboard Layout', True);
{ Decide what to do - disable/enable }
if boolState then
// Modify the Keyboard Layout Scancode Map
WriteBinaryData('Scancode Map', Data, SizeOf(Data))
else
DeleteValue('Scancode Map');
// Inform the user to restart Windows
MessageDlg('Restart Windows in order the changes to take effect!',
mtInformation, [mbOK], 0);
CloseKey;
end;
finally
SystemReg.Free;
end;
except
MessageDlg('Error occurred while trying to disable ctrl+alt+del and Task Manager',
mtWarning, [mbOK],0 );
end;
end;