Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
Disable Ctrl-Alt-Del and Alt-Tab
17 comments. Current rating: (1 votes). Leave comments and/ or rate it.
Issues:
The program should be nice and small so it can load before a user can hit CTRL-ALT-DEL.
Solution:
Compile a single WIN32API call into a small .exe in delphi.
Note:
This was written for Delphi 2 (thus Unit name WINPROCS) and the code actually only works under Windows 3.x and 95/98.
 | |  | | program small;
uses WinProcs;
var
Dummy : integer;
begin
Dummy := 0;
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 1, @Dummy, 0);
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, @Dummy, 0);
end. | |  | |  | You don't like the formatting? Check out SourceCoder then!
Comments:
| You are on page 1 of 2, other pages: [1] 2 | |
ncaparas@yahoo.com from Philippines
|
|
|
|
i want to know how to disable CTRL-ATL-DEL in Win2k / WinXP?
i found a shareware component called dWinLock. the component can disable it and other winkey combination even the 'winkey' on the keyboard. the problem is its a shareware
waiting for you kind reply
thanks in advance
norman
|
|
anonymus from Philippines
|
|
|
|
Sorry wrong click....
|
|
anonymous from Germany
|
|
|
|
disable CTRL-ATL-DEL in Win2k / WinXP:
uses
registry;
Procedure TaskManager(Const status:Boolean);
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if
. OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policiesies\System',True)
then
Reg.WriteInteger('DisableTaskMgr',Integer(Status));
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//Disabled := True;
//Enabled := False;
procedure TForm1.Button1Click(Sender: TObject);
begin
TaskManager(true); //Taskmanager deaktivieren
end;
|
|
anonymous from Brazil
|
|
|
|
this code it's wrong!
|
|
anonymous from Turkey
|
|
|
|
program small;
{written by rleigh@deakin.edu.au (Richard Leigh, Deakin Univesity 1997}
uses WinProcs;
{$R *.RES}
var
Dummy : integer;
begin
Dummy := 0;
{Disable ALT-TAB}
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 1, @Dummy, 0);
{Disable CTRL-ALT-DEL}
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, @Dummy, 0);
end.
//This code did not work on vista.
|
|
guo_qiang@live.com from China
|
|
|
|
i want to know how to disable CTRL+ALT in WinXP/vista/WinServer2008 ?
i don't know how to do it ,and i looking for the code for a long time ,but i did't find it ,can u help me with it ? thanks , my e-mail:guo_qiang@live.com
thanks
|
|
anonymous from Philippines
|
|
|
|
fact u
|
|
OJAS from United States
|
|
|
|
|
|
guo_qiang@live.com from China
|
|
|
|
thanks for all of u , i have already resolve this problem, but the code i forgot now, but i will post it here when i use my own computer, the code is on my own computer...
thanks again
|
|
anonymous from Indonesia
|
|
|
|
i use this code & it work:
uses registry;
procedure DisableTaskMgr(bTF: Boolean);
var
reg: TRegistry;
begin
reg := TRegistry.Create;
try
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('Software', True);
reg.OpenKey('Microsoft', True);
reg.OpenKey('Windows', True);
reg.OpenKey('CurrentVersion', True);
reg.OpenKey('Policies', True);
reg.OpenKey('System', True);
if bTF = True then begin
reg.WriteString('DisableTaskMgr', '1');
end else if bTF = False then begin
reg.DeleteValue('DisableTaskMgr');
end;
finally
reg.CloseKey;
reg.Free;
end;
end;
procedure TForm1.Button1Click(sender: TObject);
begin
DisableTaskMgr(true); //this disable CTRL-ALT-DEL
end;
procedure TForm1.Button2Click(sender: TObject);
begin
DisableTaskMgr(false); //this enable CTRL-ALT-DEL
end;
|
|
guo_qiang@live.com from China
|
|
|
|
我也在找这个……据说居于安全理由这个热 是那么容易屏蔽的说……
我看到以下代码… …我自己还没测试……你可以先参考一下………
I am looking for these too, people said because the security so it's not easy to be disable(taskmgr)
i found this , i didn't test it ,but you can have a try
and there is another code , i didn't test it too , sorry ...
unit RaKeyBlock;
interface
uses
SysUtils, Classes, windows, ShlObj, Registry, shellapi, Messages;
type
TRaKeyBlock = class(TComponent)
private
fBCAD: Boolean;
fBAT: Boolean;
fBCE: Boolean;
fEnabled: Boolean;
fBAE: Boolean;
fBCR: Boolean;
fBCK: Boolean;
fBP: Boolean;
fBS: Boolean;
fCKC: Cardinal;
fBWA: Boolean;
fBCAE: Boolean;
procedure SetBCAD(const Value: Boolean);
procedure SetBAT(const Value: Boolean);
procedure SetBCE(const Value: Boolean);
procedure SetEnabled(const Value: Boolean);
procedure SetBAE(const Value: Boolean);
procedure SetBCK(const Value: Boolean);
procedure SetBCR(const Value: Boolean);
procedure SetBP(const Value: Boolean);
procedure SetBS(const Value: Boolean);
procedure SetBWA(const Value: Boolean);
procedure SetBCAE(const Value: Boolean);
protected
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property BlockCtrlAltDelete: Boolean read fBCAD write SetBCAD;
property BlockAltTab: Boolean read fBAT write SetBAT;
property BlockCtrlEsc: Boolean read fBCE write SetBCE;
property BlockAltEsc: Boolean read fBAE write SetBAE;
property BlockCtrlEnter: Boolean read fBCR write SetBCR;
property BlockSleep: Boolean read fBS write SetBS;
property BlockPower: Boolean read fBP write SetBP;
property CustomKeyCode: Cardinal read fCKC write fCKC default 0;
property BlockCustomKey: Boolean read fBCK write SetBCK;
property BlockWinApps: Boolean read fBWA write SetBWA;
property BlockCtrlAltEnter: Boolean read fBCAE write SetBCAE;
property Enabled: Boolean read fEnabled write SetEnabled default false;
end;
type
KBDLLHOOKSTRUCT = record
vkCode: DWORD;
scanCode: DWORD;
flags: DWORD;
Time: DWORD;
dwExtraInfo: DWORD; end;
PKBDLLHOOKSTRUCT = ^KBDLLHOOKSTRUCT;
const
LLKHF_ALTDOWN = KF_ALTDOWN shr 8;
WH_KEYBOARD_LL = 13;
var
hhkNTKeyboard: HHOOK = 0;
KH:TRaKeyBlock;
aBCAD:boolean=False;
aBWA:boolean=False;
aBCE:boolean=False;
aBAT:boolean=False;
aBAE:boolean=False;
aBCR:boolean=False;
aBCAE:boolean=False;
aBP:boolean=False;
aaBS:boolean=False;
aBCK:boolean=False;
aCKC:Cardinal=0;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Rarnu Components', [TRaKeyBlock]);
end;
{ TRaKeyBlock }
constructor TRaKeyBlock.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
procedure EnableCTRLALTDEL(YesNo: Boolean);
const
sRegPolicies' \Software\Microsoft\Windows\CurrentVersion\Policies';
begingin
with TRegistry.Create do
try
RootKey := HKEY_CURRENT_USER;
if OpenKey(sRegPolicies + '\System\', True) then
begin
case YesNo of
false:
begin
WriteInteger('DisableTaskMgr', 1); //任务管理
WriteInteger('DisableLockWorkstation', 1); //用户锁定计算机
WriteInteger('DisableChangePassword', 1); //用户更改口令
end;
True:
begin
WriteInteger('DisableTaskMgr', 0);
WriteInteger('DisableLockWorkstation', 0);
WriteInteger('DisableChangePassword', 0);
end;
end;
end;
CloseKey;
if OpenKey(sRegPolicies + '\Explorer\', True) then
begin
case YesNo of
false:
begin
WriteInteger('NoChangeStartMenu', 1); //开始菜单
WriteInteger('NoClose', 1); // 关闭系统菜单
WriteInteger('NoLogOff', 1); //注销菜单
WriteInteger('NoRun', 1); //运行菜单
WriteInteger('NoSetFolders', 1); //设置菜单
end;
True:
begin
WriteInteger('NoChangeStartMenu', 0);
WriteInteger('NoClose', 0);
WriteInteger('NoLogOff', 0);
WriteInteger('NoRun', 0);
end;
end;
end;
CloseKey;
finally
Free;
end;
end;
function LowLevelKeyboardFunc(nCode: INTEGER; w_Param: WPARAM;
l_Param: LPARAM): LRESULT; stdcall;
var
boolKey: Boolean;
p: PKBDLLHOOKSTRUCT;
const
VK_SLEEP = $5F;
VK_POWER = $5E;
begin
boolKey := false;
if nCode = HC_ACTION then
begin
case w_Param of
WM_KEYDOWN, WM_SYSKEYDOWN, WM_KEYUP, WM_SYSKEYUP:
begin
p := PKBDLLHOOKSTRUCT(l_Param);
/ /---------!-~---------------------------------------------------
{ if ((GetAsyncKeyState(VK_RBUTTON) and $8000) <> 0) then boolKey := true;
if (CHAR(p.vkCode) >= '!') and (CHAR(p.vkCode) <= '~') and
((GetKeyState(VK_CONTROL) and $8000) <> 0) then boolKey := true;
if (p.vkCode = VK_SPACE) and
((GetKeyState(VK_CONTROL) and $8000) <> 0) then boolKey := true; }
//---------F1-F12 ----------------------------------------------
{ if (p.vkCode = VK_F1) or (p.vkCode = VK_F2) or (p.vkCode = VK_F3) or
(p.vkCode = VK_F4) or (p.vkCode = VK_F5) or (p.vkCode = VK_F6) or
(p.vkCode = VK_F7) or (p.vkCode = VK_F8) or (p.vkCode = VK_F9) or
(p.vkCode = VK_F10) or (p.vkCode = VK_F11) or (p.vkCode = VK_F12) then boolKey := true;
if ((p.vkCode = VK_F1) or (p.vkCode = VK_F2) or (p.vkCode = VK_F3) or
(p.vkCode = VK_F4) or (p.vkCode = VK_F5) or (p.vkCode = VK_F6) or
(p.vkCode = VK_F7) or (p.vkCode = VK_F8) or (p.vkCode = VK_F9) or
(p.vkCode = VK_F10) or (p.vkCode = VK_F11) or (p.vkCode = VK_F12)) and
(((GetKeyState(VK_MENU) and $8000) <> 0) or ((GetKeyState(VK_CONTROL) and $8000) <> 0) or ((GetKeyState(VK_SHIFT)and$8000) <> 0)) then boolKey := true; }
/ /-------系统热键------------------------------------------------
//WIN(Left or Right)+APPS
if aBWA then
begin
if (p.vkCode = VK_LWIN) or (p.vkCode = VK_RWIN) or (p.vkCode = VK_APPS) then boolKey := True;
end;
//CTRL+ESC
if aBCE then
begin
if (p.vkCode = VK_ESCAPE) and ((GetKeyState(VK_CONTROL) and $8000) <> 0) then boolKey := True;
end;
//ALT+TAB
if aBAT then
begin
if (p.vkCode = VK_TAB) and ((GetAsyncKeyState(VK_MENU) and $8000) <> 0) then boolKey := True;
end;
//ALT+ESC
if aBAE then
begin
if (p.vkCode = VK_ESCAPE) and ((p.flags and LLKHF_ALTDOWN) <> 0) then boolKey := True;
end;
//CTRL+ENTER
if aBCR then
begin
if (p.vkCode = VK_RETURN) and ((GetKeyState(VK_CONTROL) and $8000) <> 0) then boolKey := True;
end;
//CTRL+ALT+ENTR
if aBCAE then
begin
if (p.vkCode = VK_RETURN) and ((p.flags and LLKHF_ALTDOWN) <> 0) and ((GetKeyState(VK_CONTROL) and $8000) <> 0) then boolKey := True;
end;
//POWER
if aBP then
begin
if (p.vkCode = VK_POWER) then boolKey := True;
end;
//SLEEP
if aaBS then
begin
if (p.vkCode = VK_SLEEP) then boolKey := True;
end;
/ /----------------------------------------------------------- -----------------------------------------------------------------------------
//Custom
if aBCK then
begin
if (p.vkCode = aCKC) then boolKey := True;
end;
/ /----------------------------------------------------------- -----------------------------------------------------------------------------
//if you have other key to be disable you can add it here 如果有其他要屏闭的键,添加在此处
end;
end;
end;
//hook the key and the key message will process by itself...and the retn code must be 1. 捕获这些组合键,按键消息由自己处理,必须须返回 1
if boolKey then begin Result := 1; Exit end;
//其他的按键,交由别的线程处理(过滤)
Result := CallNextHookEx(0, nCode, w_Param, l_Param);
end;
destructor TRaKeyBlock.Destroy;
begin
Enabled:=false;
inherited Destroy;
end;
procedure TRaKeyBlock.SetBAE(const Value: Boolean);
begin
fBAE := Value;
aBAE:=fBAE;
Enabled := false;
end;
procedure TRaKeyBlock.SetBAT(const Value: Boolean);
begin
fBAT := Value;
aBAT:=fBAT;
Enabled := false;
end;
procedure TRaKeyBlock.SetBCAD(const Value: Boolean);
begin
fBCAD := Value;
aBCAD:=fBCAD;
Enabled := false;
end;
procedure TRaKeyBlock.SetBCAE(const Value: Boolean);
begin
fBCAE := Value;
aBCAE:=fBCAE;
Enabled := false;
end;
procedure TRaKeyBlock.SetBCE(const Value: Boolean);
begin
fBCE := Value;
aBCE:=fBCE;
Enabled := false;
end;
procedure TRaKeyBlock.SetBCK(const Value: Boolean);
begin
fBCK := Value;
aBCK:=fBCK;
Enabled := false;
end;
procedure TRaKeyBlock.SetBCR(const Value: Boolean);
begin
fBCR := Value;
aBCR:=fBCR;
Enabled := false;
end;
procedure TRaKeyBlock.SetBP(const Value: Boolean);
begin
fBP := Value;
aBP:=fBP;
Enabled := false;
end;
procedure TRaKeyBlock.SetBS(const Value: Boolean);
begin
fBS := Value;
aaBS:=fBS;
Enabled := false;
end;
procedure TRaKeyBlock.SetBWA(const Value: Boolean);
begin
fBWA := Value;
aBWA:=fBWA;
Enabled := false;
end;
procedure TRaKeyBlock.SetEnabled(const Value: Boolean);
begin
fEnabled := Value;
//设置可用
case fEnabled of
True:
begin
if hhkNTKeyboard <> 0 then Exit;
hhkNTKeyboard := SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardFunc, HInstance, 0);
if fBCAD then
begin
EnableCTRLALTDEL(false);
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
end;
end;
false:
begin
if hhkNTKeyboard = 0 then Exit;
UnhookWindowsHookEx(hhkNTKeyboard); // 卸载钩子
EnableCTRLALTDEL(true);
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil);
hhkNTKeyboard := 0;
end;
end;
end;
end.
i am sorry that the code i post it too late...
and also sorry for my pool english.. 也在找这个……据说居于安全理由这个热键
|
|
anonymous from United States
|
|
|
|
|
|
anonymous from United States
|
|
|
|
|
|
anonymous from United States
|
|
|
|
|
| You are on page 1 of 2, other pages: [1] 2 |
|