I am learning and building my first UWP test app, and need a way to simulate:
- relative mouse movement
- absolute mouse positioning
- keyboard typing (not necessarily key presses/releases)
- fine tuned x&y scrolling (so I can scroll by any amount)
I have come across the following methods for doing this, but can't figure out which ones are modern / best for UWP apps or best in general for my purposes:
SendKeys(A C# wrapper forSendInputof some sort?)SendInput(A win32 API for simulating events, but is it best for UWP?)SendMessage(Used for directly typing into focused applications?)InputInjector(A more modern but limited way of simulating inputs, can't absolutely position cursor?)Cursor.Position(A function for cursor movement and positing)
There are so many methods and approaches to this problem, and I'm not entirely sure which of these is most supported or recommended for UWP apps, or yields the best results.
The purpose of this project is to be able to control my PC (move the mouse, type), by interacting with through my phone. For example my phone becomes a trackpad, or I can type in my phone's soft keyboard and it types into my PC. The PC hosts a server on the local network, and the phone send input data packets to this server. The server receives these input data packets, and executes them (which is where I need the ability to simulate keyboard/mouse events). Very similar to Remote Mouse.
So my questions are:
- What are the differences between these methods? (Like Windows Forms or Win32??)
- Which is best for UWP apps / my need here?
- Are there any better (not listed) solutions?
This is my first look into this stuff (C#, .NET, Windows dev) so any and all information is very helpful.
Thanks for your help!
Dan :D
Edit
Further research has shown that InputInjector is under the UWP reference, SendKeys and Cursor.Position are both under the .NET reference. Does this mean that InputInjector is the most ideal?