i've created a console application that does one click after it started. Here is the code:
class Program
{
static void Main(string[] args)
{
Thread.Sleep(5000);
mouse_event((uint)MouseEventFlags.LEFTDOWN, 100, 100, 0, 0);
Thread.Sleep(300);
mouse_event((uint)MouseEventFlags.LEFTUP, 100, 100, 0, 0);
}
[Flags]
public enum MouseEventFlags
{
LEFTDOWN = 0x00000002,
LEFTUP = 0x00000004,
MIDDLEDOWN = 0x00000020,
MIDDLEUP = 0x00000040,
MOVE = 0x00000001,
ABSOLUTE = 0x00008000,
RIGHTDOWN = 0x00000008,
RIGHTUP = 0x00000010
}
[DllImport("user32.dll")]
private static extern void mouse_event(
long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
}
This sample works in notepad, for example, but in other application it does nothing. An application in which it doesn't work is the clicker mentioned below.
what do i have to do to make it work in other applications?
Here is a clicker i found online
Clicker(take the first one), and this one can click on another applications that my program doesn't click. You can run my code in this window clicker and it doesn't work, it would be great if my clicker can click start/stop in this clicker.
Best regards!