I need method or group of them to send signals to any application (browsers, games, et cetera) about mouse movement or key input.
I can easly retrieve an IntPtr to any process, but I don't know what library or function I must use next.
I know only about SendMessage/PostMessage functions from user32.dll, but these functions can send messages only to applications with standard message loops and it doesn't work with DirectX applications. And I've noticed that something like this:
PostMessage(pFoundWindow, WM_KEYDOWN, (IntPtr)VK_RIGHT, (IntPtr)0);
Thread.Sleep(150);
PostMessage(pFoundWindow, WM_KEYUP, (IntPtr)VK_RIGHT, (IntPtr)0);
sends messages slower than DirectInput in and does not allow player to send, for example, left arrow and space, even in threads.