So I spent the last 2 hours googling but I can't get my program to work. I simply want my program to perform mouseclicks in a 3rd party window. Let's call it 'Tetris'. Something even simple script languages can do with a single line, such as:
ControlClick("Tetris", null, null, "left", 1)
Now I managed to get my C# program to click on the desktop by calling the user32.dll like this:
private static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
and later calling it in a function
public void LeftClick(int x, int y)
Which does work… except not in a 3rd party window. I tried to activate the window manually with SetForegroundWindow() but doesn't help either.
Is there any way to do it? Does somebody have an example or a tutorial (please do not just paste random Google results, as I said, I googled and none of the 'solutions' worked for me).
by DerDuderich via /r/csharp