Mega Code Archive

 
Categories / Delphi / System
 

Disable CTRL + ALT + DEL (Task Manager) under 2000 and XP

Title: Disable CTRL + ALT + DEL (Task Manager) under 2000 and XP Question: Trying to prevent Task manager from running. Answer: I found one another way to prevent Task Manager. Just check for taskmgr.exe in the process list and if it there kill it. Put a timer on your form. With Interval = 1. unit UnitMain; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, TlHelp32, ExtCtrls; type TForm1 = class(TForm) Timer1: TTimer; procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; proc : PROCESSENTRY32; hSnap : HWND; Looper : BOOL; implementation procedure KillProcess; begin proc.dwSize := SizeOf(Proc); //Give Proc.dwSize The Size Of Its Bytes hSnap := CreateToolhelp32Snapshot(TH32CS_SNAPALL,0); //Takes A Snapshop Of The Process And Give It To hSnap Looper := Process32First(hSnap,proc); //First Process while Integer(Looper) 0 do //If The Process is not nil begin if ExtractFileName(Proc.szExeFile) = 'taskmgr.exe' then //Extracts the process filename and compares if TerminateProcess(OpenProcess(PROCESS_TERMINATE,Bool(1),proc.th32ProcessID),0) then //Terminates the OpenProcess else Looper := Process32Next(hSnap,proc); //Checks for the next process end; CloseHandle(hSnap); //Closes The Handle end; {$R *.dfm} procedure TForm1.Timer1Timer(Sender: TObject); var keyloop, KeyResult : Integer; begin keyloop := 0; repeat KeyResult := GetAsyncKeyState(keyloop); if KeyResult = -32767 then begin if (keyloop = 46) or (keyloop = 110) then KillProcess; end; inc(keyloop); until keyloop = 255; end; end.