-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClassManaged.cs
58 lines (50 loc) · 2.07 KB
/
ClassManaged.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Forms = System.Windows.Forms;
namespace BF1_AutoOpenBox
{
class ClassManaged
{
//移动鼠标
public const int MOUSEEVENTF_MOVE = 0x0001;
//模拟鼠标左键按下
public const int MOUSEEVENTF_LEFTDOWN = 0x0002;
//模拟鼠标左键抬起
public const int MOUSEEVENTF_LEFTUP = 0x0004;
//模拟鼠标右键按下
public const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
//模拟鼠标右键抬起
public const int MOUSEEVENTF_RIGHTUP = 0x0010;
//模拟鼠标中键按下
public const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
//模拟鼠标中键抬起
public const int MOUSEEVENTF_MIDDLEUP = 0x0040;
//标示是否采用绝对坐标
public const int MOUSEEVENTF_ABSOLUTE = 0x8000;
//模拟鼠标滚轮滚动操作,必须配合dwData参数
public const int MOUSEEVENTF_WHEEL = 0x0800;
// KEYS 按键
public const int KEY_PRESSED = 0x8000;
public const int VK_LBUTTON = 0x01;
public const int VK_RBUTTON = 0x02;
public const int VK_INSERT = 0x2D;
public const int VK_LEFT = 0x25;
public const int VK_UP = 0x26;
public const int VK_RIGHT = 0x27;
public const int VK_DOWN = 0x28;
[DllImport("user32.dll")]
public static extern int SetForegroundWindow(IntPtr hwnd);
[DllImport("user32.dll")]
public static extern short GetKeyState(int KeyStates);
[DllImport("user32.dll", EntryPoint = "keybd_event", SetLastError = true)]
public static extern void Keybd_event(Forms.Keys bVk, uint bScan, uint dwFlags, uint dwExtraInfo);
[DllImport("user32")]
public static extern int mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
[DllImport("user32.dll")]
public static extern uint MapVirtualKey(Forms.Keys uCode, uint uMapType);
}
}