Hannx
New member
1. Make new class:
2. Create simple form, with 2x button and 1 text edit.
2.1 First button:
2.2 Next button:
2.3 Textbox with 2 events:
3. Renember to init List<IntPtr> _ptr
---------
Let's play:
Click button1 and select your WoW.exe.
Click button2 to run WoW.exe (1 click == 1 wow)
Click on TextBox and enjoy (without tab and arrows)
Code:
public static class MyButton
{
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
public static void Down(int k,List<IntPtr> ptrs)
{
const uint WM_KEYDOWN = 0x100;
foreach (var ptr in ptrs)
SendMessage(ptr, WM_KEYDOWN, ((IntPtr)k), (IntPtr)0);
}
internal static void Up(int keyValue, List<IntPtr> ptrs)
{
const int WM_KEYUP = 0x101;
foreach (var ptr in ptrs)
SendMessage(ptr, WM_KEYUP, ((IntPtr)keyValue), (IntPtr)0);
}
}
2. Create simple form, with 2x button and 1 text edit.
2.1 First button:
Code:
private string _path;
private void button1_Click(object sender, EventArgs e)
{
var openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Exek WoWa|Wow.exe";
openFileDialog.Multiselect = false;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
_path = openFileDialog.FileName;
}
}
Code:
private List<IntPtr> _ptr;
private void button2_Click(object sender, EventArgs e)
{
Process p = Process.Start(_path);
p.WaitForInputIdle();
IntPtr h = p.MainWindowHandle;
_ptr.Add(h);
}
2.3 Textbox with 2 events:
Code:
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
MyButton.Down(e.KeyValue, _ptr);
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
MyButton.Up(e.KeyValue, _ptr);
}
---------
Let's play:
Click button1 and select your WoW.exe.
Click button2 to run WoW.exe (1 click == 1 wow)
Click on TextBox and enjoy (without tab and arrows)