Hey guys, I'm working on a pixel based bot and right now I have a class set up for input that looks like this
This code works if i want to use it anywhere else, but when i attempt to use it on the game, the hook is blocked im assuming, and although the click is executed (message box pops up) the click doesnt actually work. Does anyone know a way I can get around this to make it look like the input is really coming from my mouse? ive searched for days on this and havent found a better way.
any insight would be greatly appreciated
Code:
class PushKey
{
[DllImport("user32.dll", SetLastError = true)]
static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
[DllImport("user32.dll")]
private static extern void mouse_event(UInt32 dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, IntPtr dwExtraInfo);
public static void leftClick()
{
const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, new IntPtr());
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, new IntPtr());
MessageBox.Show("mouseclicked");
}
}
any insight would be greatly appreciated