Mauro sua ideia de usar aplication.Title:=´´; e boa mas o processo ainda continua rodando. Ele some da lista de aplicativos mas da de processos naum. O que eu to tentando fazer para resolver isso é quando alguem apertar ctrl+alt+del sua aplicação perde o focus dai vc simula o ´alt+f4´
e reseta o focu pro seu aplicativo e bloqueia as teclas alt+f4 ctrl+esc e outras.
veja como bloque ar as teclas de atalho so num funciona pro ctrl +alt+del
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
WH_KEYBOARD_LL = 13;
LLKHF_ALTDOWN = $20;
type
KBDLLHOOKSTRUCT = record
vkCode: DWORD;
scanCode: DWORD;
flags: DWORD;
time: DWORD;
dwExtraInfo: Longint ;
end;
var
hhkLowLevelKybd : HHOOK;
FoldProc : LongInt;
hSASWnd : HWND;
hThread : Cardinal;
Form1: TForm1;
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 TForm1.FormCreate(Sender: TObject);
begin
hhkLowLevelKybd := 0;
hhkLowLevelKybd := SetWindowsHookEx(WH_KEYBOARD_LL, @LowLevelKeyboardProc,
HInstance, 0);
application.title:=´´;
end;
end.
As dicas do início fucionam para o windows 9x e a penultima até para o XP. Esta funciona para XP, uma vez que o XP não permite que sejam manipulados determinados controladores internos, o que temos que fazer é bloquear a apresentação da caixa ´Gerenciador de tarefas´, resultante do pressionamento do CTRL+ALT+DEL
uses registry;
var
reg : tregistry;
begin
reg:=tregistry.create;
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey(´\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System´, true);
reg.writebool(´DisableTaskMgr´, true);
end;
Qualquer dúvida estamos ai
Sanses
unit UnitTravasEspeciais;
interface
uses Windows, Messages;
type
PKBDLLHOOKSTRUCT = ^KBDLLHOOKSTRUCT;
KBDLLHOOKSTRUCT = packed record
vkCode : DWORD;
scanCode : DWORD;
flags : DWORD;
time : DWORD;
dwExtraInfo : DWORD;
end;
const
LLKHF_EXTENDED = $00000001;
LLKHF_INJECTED = $00000010;
LLKHF_ALTDOWN = $00000020;
LLKHF_UP = $00000080;
LLMHF_INJECTED = $00000001;
WH_Keyboard_LL = 13;
procedure StartHook; stdcall;
procedure StopHook; stdcall;
implementation
var
OldHook: HHook;
function LowLevelHookProc(nCode:Integer; awParam: WPARAM;
alParam:LPARAM): LRESULT; stdcall;
var
ControlPressed, AltPressed, EscapePressed, WinPressed, TabPressed:
boolean;
pkbhs: PKBDLLHOOKSTRUCT;
FilterThis: boolean;
begin
FilterThis := false;
if nCode = HC_ACTION then
begin
pkbhs := PKBDLLHOOKSTRUCT(alParam);
ControlPressed := (GetAsyncKeyState(VK_CONTROL) and $8000) <> 0;
AltPressed := ((pkbhs^.flags and LLKHF_ALTDOWN)<>0);
EscapePressed := (pkbhs^.vkCode = VK_ESCAPE);
WinPressed := (pkbhs^.vkCode in [VK_LWIN, VK_RWIN]);
TabPressed := (pkbhs^.vkCode = VK_TAB);
// Disable WINDOWS Key
if WinPressed then
FilterThis := true
else
// Disable CTRL+ESC
if ControlPressed and EscapePressed then
FilterThis := true
else
// Disable ALT+TAB
if AltPressed and TabPressed then
FilterThis := true
else
// Disable ALT+ESC
if AltPressed and EscapePressed then
FilterThis := true;
end;
if not FilterThis then
Result:= CallNextHookEx (OldHook, nCode, awParam, alParam)
else
Result := 1;
end;
procedure StartHook; stdcall;
begin
OldHook := SetWindowsHookEx(WH_Keyboard_LL, LowLevelHookProc,
HInstance, 0);
end;
procedure StopHook; stdcall;
begin
UnHookWindowsHookEx(OldHook);
end;
end.