-
Notifications
You must be signed in to change notification settings - Fork 0
/
Window.cs
58 lines (37 loc) · 1.27 KB
/
Window.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.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Drawing;
namespace LordsBot
{
class Window
{
public static void setWindowSize(int handl) {
Win32.SetWindowPos(handl, IntPtr.Zero, 20, 20, 837, 501, 0x0040 | 0x0020 | 0x0002 | 0x0004);
Win32.UpdateWindow(handl);
}
public static int findWindow(string ClassName, string WindowName) {
//EXAMPLE: FindWindow("Qt5QWindowIcon", "bot1");
//EXAMPLE: FindWindow("Windows_ID", "Windows_Name");
int iHandle = Win32.FindWindow(ClassName, WindowName);
return iHandle;
}
//returns the x,y coords of the handle on the screen.
public static Point CoordOfHandle(int handl)
{
Point p = new Point();
Win32.ClientToScreen(handl, ref p);
return p;
}
// X = Width, Y= Height
public static Point SizeOfWindow(int handl)
{
RECT rc; //creates a rectangle
Win32.GetWindowRect(handl, out rc); //gets dimensions of the window
return new Point(rc.Width, rc.Height);
}
}
}