-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Делаю хак для раста, пытаюсь сделать hotkeysб но он не работает, помогите.
GetAsyncKeyState тоже пробавал
C#:
public partial class Display : Form
{
public const String WINDOW_NAME = "Rust";
[DllImport("user32.dll")]
public static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);
public static IntPtr handle = FindWindow(null, WINDOW_NAME);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string IpClassName, string IpWindowName);
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", SetLastError = true)]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hwnd, out RECT IpRect);
public static RECT rect;
public struct RECT
{
public int left, top, right, bottom;
}
public Display()
{
InitializeComponent();
}
private void Display_Load(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
this.BackColor = Color.Wheat;
this.TransparencyKey = Color.Wheat;
this.FormBorderStyle = FormBorderStyle.None;
this.TopMost = true;
int initialStyle = GetWindowLong(this.Handle, -20);
SetWindowLong(this.Handle, -20, initialStyle | 0x8000 | 0x20);
GetWindowRect(handle, out rect);
this.Size = new Size(rect.right - rect.left, rect.bottom - rect.top);
this.Left = rect.left;
this.Top = rect.top;
backgroundWorker1.RunWorkerAsync();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
while (true)
{
GetWindowRect(handle, out rect);
this.Size = new Size(rect.right - rect.left, rect.bottom - rect.top);
this.Left = rect.left;
this.Top = rect.top;
Thread.Sleep(10);
}
}
private void espEnable_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F)
{
this.espEnable.Enabled = !this.espEnable.Enabled;
}
}
}
GetAsyncKeyState тоже пробавал
Последнее редактирование: