I want to move the mouse and simulate mouse clicks outside of my application.
I've tried every possible way of moving the mouse, sendinput, tons of libraries including BotSuite and Input Simulator.
Every time my application loses focus it's not moving the mouse, nor clicking. I can move the mouse, and click inside my application, but as soon as I lose focus it stops working completely. I can not click on anything outside of my application either, even while in focus.
Why is that?
Here's a snippet using BotSuite. I'm starting a process before this and make it the focus.
Bitmap CapturedScreen = ScreenShot.Create(LauncherHandle);
Bitmap bmpRefPic = new Bitmap("launchbutton.png");
ImageData refpic = new ImageData(bmpRefPic);
ImageData source = new ImageData(CapturedScreen);
List<Rectangle> found = new List<Rectangle>();
found = Template.AllImages(source, refpic, 124);
Mouse.MoveRelativeToWindow(LauncherHandle, found[0].X + 50, found[0].Y + 50, true, 100);
Mouse.LeftClick();
This is not working. However if I do a SetForegroundWindow on my own Application beforehand, the Mouse.Move command works. Clicking does not work either way outside of my applications boundaries.