Текущий архив: 2005.09.04;
Скачать: CL | DM;
Вниз
Блокировка клавиатуры Найти похожие ветки
← →
Михаил(Киров) (2005-07-16 10:28) [0]Выташив из User32.dll процедуру BlockInput, столкнулся с одной проблемой. Всё нормально работает, но при нажатии Alt+Ctrl+Del блокировка снимается и появляется диспетчер задач. Эту проблему я решил, простым закрытием окна "Диспетчер задач Windows", но это делает мою программу нерациональной (на некоторых компьютерах выскакивает "Безопасность Windows", и окно не убивается). Есть ли способ более грамотного перехвата Alt+Ctrl+Del?
Для большей понятности привожу свой код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ExtCtrls, ShellApi, StdCtrls;
type
TLock = record
Loaded:bool;
Locked:function(Value:bool):bool;stdcall;
end;
TGlob = record
Lock:TLock;
end;
type
TForm1 = class(TForm)
LockTimer: TTimer;
SpeedButton1: TSpeedButton;
Timer3: TTimer;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure SpeedButton1Click(Sender: TObject);
procedure LockTimerTimer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
WinCaption = "Диспетчер задач Windows";
var
Form1: TForm1;
Glob:TGlob;
implementation
{$R *.dfm}
function BlockInputLoad(var BlockInputPoint:Pointer):boolean;
var BlockInputHandle:THandle;
begin
result:=false;
BlockInputPoint:=nil;
if LoadLibrary(PChar("User32.dll"))=0 then exit;
BlockInputHandle:=GetModuleHandle(PChar("User32.dll"));
if BlockInputHandle<>0 then
begin
BlockInputPoint:=GetProcAddress(BlockInputHandle,PChar("BlockInput"));
if BlockInputPoint<>nil then result:=true;
end;
end;
procedure NewLock(Value:Bool);
begin
If Value then
Form1.LockTimer.Enabled:=True
else
begin
Form1.LockTimer.Enabled:=False;
Glob.Lock.Locked(False)
end;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
NewLock(True);
Timer3.Enabled:=True;
end;
procedure TForm1.LockTimerTimer(Sender: TObject);
begin
If Glob.Lock.Loaded then
Glob.Lock.Locked(True);
If FindWindow(nil,"Диспетчер задач Windows") <> 0 then
PostMessage(FindWindow(nil,WinCaption),wm_quit,0,0);
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
NewLock(False);
Timer3.Enabled:=False;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
If BlockInputLoad(@Glob.Lock.Locked)=true then Glob.Lock.Loaded:=True;
end;
end.
У LockTimer Interval = 1,
у Timer3 Interval = 10000
← →
Kerk © (2005-07-16 11:03) [1]Глянь это:
http://kladovka.net.ru/index.cgi?pid=list&rid=84
Страницы: 1 вся ветка
Текущий архив: 2005.09.04;
Скачать: CL | DM;
Память: 0.45 MB
Время: 0.009 c