Hi i need help with my program, i made a console application in c# and Leap Motion Device, my program simulates a virtual mouse, moving the cursor and Left/Right click, using
[System.Runtime.InteropServices.DllImport("user32.dll")]
and
public static void MouseClickLeft(int x, int y)
{
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
}
public static void MouseClickRight(int x, int y)
{
mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 0);
}
I need run this program with another app, but the mouse control only works if the Console application its running as the main window, its stops working when i do the left click in the desktop or another app. Im beginner in programming with c#, there is anything that i can do to make this running in the background and still moving the mouse?