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:

I answered this before, I just can't find the question. There is no 'universal' way unless you go as far as writing a mouse and keyboard driver that accepts commands from userspace.
–
Jonathan DickinsonNov 8 '11 at 22:13

What you need to target today: Windows Input via PostMessage, DirectX via DLL Hooking (can't do this in C#) and XInput via DLL Hooking (can't do this in C#).
–
Jonathan DickinsonNov 8 '11 at 22:14

Well, I can't believe that there is no way to send input to other application through C# and I'll try to continue research about them. Also, I have only one alternative C++ - is there are methods for this language? Please, give links to examples if you have it.
–
DracontisNov 9 '11 at 13:27

2

you can do it in C++ - but apart from knowing the universal method would be a 'virtual' mouse and keyboard I know nothing else. You will need to download the DDK (Windows Device Driver Kit) and start there.
–
Jonathan DickinsonNov 9 '11 at 14:44

Yes, I tried SendKeys. It is hight level way, so this won't work in every game. For now I haven't time for research, but I think small application with WinAPI using DDK examples (create message loop and send equivalents of all messages to DDK driver) will solve my problem, but I do not start it yet.
–
DracontisDec 9 '11 at 15:24