-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProgram.cs
More file actions
38 lines (35 loc) · 1.03 KB
/
Program.cs
File metadata and controls
38 lines (35 loc) · 1.03 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HiClicker
{
internal static class Program
{
static MainWindow m;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.SetCompatibleTextRenderingDefault(false);
m = new MainWindow();
var k_hook = new HotKeyApi();
k_hook.KeyDownEvent += new KeyEventHandler(hook_KeyDown);//钩住键按下
k_hook.Start();//安装键盘钩子
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.Run(m);
}
static private void hook_KeyDown(object sender, KeyEventArgs e)
{
//判断按下的键(Esc)
if (e.KeyValue == (int)Keys.Escape)
{
m.enableRunning = false;
}
}
}
}