-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhax.cs
76 lines (66 loc) · 1.79 KB
/
hax.cs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Gma.System.MouseKeyHook;
namespace NoRecoil
{
public partial class Form1 : Form
{
private IKeyboardMouseEvents m_GlobalHook;
public Form1()
{
InitializeComponent();
m_GlobalHook = Hook.GlobalEvents();
m_GlobalHook.MouseDownExt += GlobalHookMouseDownExt;
m_GlobalHook.MouseUpExt += GlobalHookMouseUpExt;
m_GlobalHook.KeyPress += GlobalHookKeyPress;
}
private bool _enabled = false;
private int frequence = 0;
private bool enabled
{
get
{
return _enabled;
}
set
{
_enabled = value;
}
}
private void EnableNoRecoil()
{
int i = 0;
while (i < 5)
{
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y + 15);
System.Threading.Thread.Sleep(25);
i++;
}
}
private void GlobalHookMouseDownExt(object sender, MouseEventExtArgs e)
{
if (enabled) EnableNoRecoil();
}
private void GlobalHookMouseUpExt(object sender, MouseEventExtArgs e)
{
}
private void GlobalHookKeyPress(object sender, KeyPressEventArgs e)
{
string key = e.KeyChar.ToString();
if (key == "b" && !enabled)
{
enabled = true;
} else if (key == "b" && enabled)
{
enabled = false;
}
}
}
}