Write a value at a certain display position outside the form

Asked

Viewed 77 times

0

I’m developing an application in Windows Forms, with C#. For example: I want to write a text in the youtube search field, as seen through:http://prntscr.com/ck0vo2

Can anyone tell me how to send a string, phrase, to a certain screen position?

I can already position the cursor and click on the place where it is necessary to write the string. But now I’m missing the part of writing the same.

I’ve consulted documentation on Sendkeys but I don’t think it’s good for me...

To move the cursor to the position I want:

 //This is a replacement for Cursor.Position in WinForms
    [System.Runtime.InteropServices.DllImport("user32.dll")]
    static extern bool SetCursorPos(int x, int y);
    SetCursorPos(10, 20);

1 answer

1

For those who need I found a project, in c# that does precisely this, just be with the cursor in the place to write: https://www.nuget.org/packages/InputSimulator/

Example use:

InputSimulator i=new InputSimulator();
i.Keyboard.TextEntry("Ola mundo");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.