I'm working on a bot for GW2 using C#. I can detect pixels, and use the mouse to move and click etc, but for some reason sending keys isn't working for me.
I've tried:
Code:
SendKeys.SendWait("1"); // does nothing except pop the menu for some reason.
Also:
Code:
BotControl.SendMessage(win, WM_KEYDOWN, ((IntPtr) Keys.Oem1), IntPtr.Zero);
Seems to do nothing that I can tell.
Code:
BotControl.PostMessage(win, BotControl.WM_KEYDOWN, ((IntPtr) Keys.Oem1),IntPtr.Zero);
Does nothing, but if I select the chat window it drops ";" in chat instead of "1".
Also tried the Virtual Keyboard:
Code:
[DllImport("user32.dll")]
private static extern uint keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
public static void KeyDown(Keys key)
{
keybd_event((byte) key, 0, 0, 0);
}
public static void KeyUp(Keys key)
{
keybd_event((byte) key, 0, 0x0002, 0);
}
doing
Code:
KeyDown(Keys.Oem1);
KeyUp(Keys.Oem1);
And it also does nothing, but if I select the chat window it prints ";" again.
Any ideas what could be going wrong? Did this for WOW, EVE and SWTOR without issue.