using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Tibia_920_Bot
{
public partial class mainForm : Form
{
public mainForm()
{
InitializeComponent();
}
const int WM_KEYDOWN = 0x0100;
const int WM_KEYUP = 0x0101;
const int VK_F1 = 0x70;
//The handle that will hold tibia
IntPtr Tibia_Handle;
//Import SendMessage from user32.dll which will send a keypress to the client.
[DllImport("User32.Dll")]
static extern bool PostMessage(
IntPtr hWnd,
uint msg,
int wParam,
int lParam
);
[DllImport("USER32.DLL")]
static extern IntPtr FindWindow(
string lpClassName,
string lpWindowName);
private void mainForm_Load(object sender, EventArgs e)
{
Tibia_Handle = FindWindow(null, "Tibia");
}
private void button1_Click(object sender, EventArgs e)
{
PostMessage(Tibia_Handle, WM_KEYDOWN, VK_F1, WM_KEYUP);
}
}
}