Fórum Como desabilitar CTRL ALT DEL no Windows 2000 #240579
30/06/2004
0
Como eu eu posso desabilitar o CRTL+ALT+DEL no windows 2000?
Me ajudem! :(
Ampaline
Curtir tópico
+ 0Posts
30/06/2004
Cabelo
Declare em Types..
const
WH_KEYBOARD_LL = 13;
LLKHF_ALTDOWN = $20;
type
KBDLLHOOKSTRUCT = record
vkCode: DWORD;
scanCode: DWORD;
flags: DWORD;
time: DWORD;
dwExtraInfo: Longint ;
end;
var
Form : TForm;
hhkLowLevelKybd : HHOOK;
FoldProc : LongInt;
hSASWnd : HWND;
hThread : Cardinal;
crie esta função acima de qualquer procedure ou function
Function LowLevelKeyboardProc(nCode : Integer; wParam : Longint; var LParam: KBDLLHOOKSTRUCT) : Longint; stdcall;
var
fEatKeystroke : Boolean;
dwThreadId : Cardinal;
begin
If (nCode = HC_ACTION) Then
begin
If (wParam = WM_KEYDOWN) Or
(wParam = WM_SYSKEYDOWN) Or
(wParam = WM_KEYUP) Or
(wParam = WM_SYSKEYUP) Then
begin
fEatKeystroke :=
//-----------
(((GetKeyState(VK_CONTROL) And $8000) <> 0) and
((((GetKeyState(VK_RMENU)) or (GetKeyState(VK_LMENU))) And $8000) <> 0) and
(LParam.vkCode = VK_DELETE)) or
//--------------
((LParam.vkCode = VK_LWIN)) or //tecla menu iniciar esquerdo
((LParam.vkCode = VK_RWIN)) or //tecla menu iniciar direito
((LParam.vkCode = VK_F4) And ((LParam.flags And LLKHF_ALTDOWN ) <> 0)) Or //ALT + F4
((LParam.vkCode = VK_TAB) And ((LParam.flags And LLKHF_ALTDOWN ) <> 0)) Or //ALT + TAB
((LParam.vkCode = VK_ESCAPE) And ((LParam.flags And LLKHF_ALTDOWN ) <> 0)) Or //ALT + ESC
((LParam.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And $8000) <> 0)); //CONTROL + ESC
End;
End;
If fEatKeystroke Then
Result := -1
Else
Result := CallNextHookEx(0, nCode, wParam, LongInt(@LParam));
End;
no evento onCreate do form
hhkLowLevelKybd := 0;
hhkLowLevelKybd := SetWindowsHookEx(WH_KEYBOARD_LL, @LowLevelKeyboardProc,
HInstance, 0);
sem mais..
espero ter ajudado..
Cabelo
Gostei + 0
30/06/2004
Ampaline
Eu fiz exatamente o que vc escreveu e, não funcionou. Vê se tem algo de errado?
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, jpeg, StdCtrls, Buttons, Menus,registry ;
const
WH_KEYBOARD_LL = 13;
LLKHF_ALTDOWN = $20;
type
KBDLLHOOKSTRUCT = record
vkCode: DWORD;
scanCode: DWORD;
flags: DWORD;
time: DWORD;
dwExtraInfo: Longint ;
end;
type
Tfrm_fullscreen = class(TForm)
edt_senha: TEdit;
cbx_tipo: TComboBox;
Button2: TButton;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_fullscreen: Tfrm_fullscreen;
hhkLowLevelKybd : HHOOK;
FoldProc : LongInt;
hSASWnd : HWND;
hThread : Cardinal;
const
MOD_ALT = 1;
implementation
{$R *.dfm}
Function LowLevelKeyboardProc(nCode : Integer; wParam : Longint; var LParam: KBDLLHOOKSTRUCT) : Longint; stdcall;
var
fEatKeystroke : Boolean;
dwThreadId : Cardinal;
begin
If (nCode = HC_ACTION) Then
begin
If (wParam = WM_KEYDOWN) Or
(wParam = WM_SYSKEYDOWN) Or
(wParam = WM_KEYUP) Or
(wParam = WM_SYSKEYUP) Then
begin
fEatKeystroke :=
//-----------
(((GetKeyState(VK_CONTROL) And $8000) <> 0) and
((((GetKeyState(VK_RMENU)) or (GetKeyState(VK_LMENU))) And $8000) <> 0) and
(LParam.vkCode = VK_DELETE)) or
//--------------
((LParam.vkCode = VK_LWIN)) or //tecla menu iniciar esquerdo
((LParam.vkCode = VK_RWIN)) or //tecla menu iniciar direito
((LParam.vkCode = VK_F4) And ((LParam.flags And LLKHF_ALTDOWN ) <> 0)) Or //ALT + F4
((LParam.vkCode = VK_TAB) And ((LParam.flags And LLKHF_ALTDOWN ) <> 0)) Or //ALT + TAB
((LParam.vkCode = VK_ESCAPE) And ((LParam.flags And LLKHF_ALTDOWN ) <> 0)) Or //ALT + ESC
((LParam.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And $8000) <> 0)); //CONTROL + ESC
End;
End;
If fEatKeystroke Then
Result := -1
Else
Result := CallNextHookEx(0, nCode, wParam, LongInt(@LParam));
End;
procedure Tfrm_fullscreen.FormCreate(Sender: TObject);
begin
hhkLowLevelKybd := 0;
hhkLowLevelKybd := SetWindowsHookEx(WH_KEYBOARD_LL, @LowLevelKeyboardProc,
HInstance, 0);
end;
end.
Gostei + 0
30/06/2004
Cabelo
Gostei + 0
30/06/2004
Ampaline
Não gerou erro, mas não travou o CRTL+ALT+DEL.
Gostei + 0
30/06/2004
Cabelo
//função que retorna a API do Windows para normal
UnhookWindowsHookEx(hhkLowLevelKybd);
hhkLowLevelKybd := 0;
Eu passei a função errada pra vc..
esta função é ao contrário da que vc pediu, ela trava as teclas de atalho do windows..
na verdade a função que vc precisa é uma função que altera o registro do windows..
sem mais
Cabelo
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)