M
M
mIka012020-12-22 14:52:50
Keyboard
mIka01, 2020-12-22 14:52:50

How to control mouse and keyboard in c#?

Hello, I have a seemingly simple question and once I solved it, but I forgot how.

How to emulate keystrokes (similar to the user's physical pressing) of the keyboard, cursor movement and mouse button presses.
I am writing in a console application, so I can sample code for performing each action separately (keyboard, cursor movement and mouse clicks).

[I] If you need to use a library, then it is advisable to use those that can be downloaded from under Microsoft Visual Studio. [/ I]

If possible, give an example of code where the cursor moves to some coordinates, press the left mouse button and write the word [U] hello [/ U].

Thank you in advance.

PS I will have to explain this to my parents (I teach them programming, even though I studied it at school), they wanted to study it by writing something like a compiler (the Brainfuck compiler was written at school), but this time they want something like a graphic one. We have already written it, but then I have to explain how to perform the above steps, but I myself cannot do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2020-12-22
@mIka01

Look towards www.pinvoke.net/default.aspx/user32.sendinput

I will have to explain this to my parent

It's already more difficult.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question